﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
23011	Custom http headers aren't applied on custom imagery sources	svintuss@…	team	"==== What steps will reproduce the problem?
1. Add a custom TMS source. In my case it's `https://pkk.rosreestr.ru/GISWebServiceSE/service.php?SERVICE=WMTS&REQUEST=GetTile&VERSION=3.0.0&LAYER=PKKm&STYLE=default&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=image%2Fpng`, one may use `https://ngw.fppd.cgkipd.ru/tile/56/{z}/{x}/{y}.png` which doesn't require installing a custom TLS certificate. 
2. Modify `customHttpHeaders` in corresponding entry in `Advanced preferences > imagery.entries` to `{""User-Agent"":""Mozilla/5.0 (JOSM)""}`


==== What is the expected result?
Custom header in GET request to TMS server.

==== What happens instead?
Requests ignore headers set in `customHttpHeaders` and are still sent with default user-agent:
{{{
2023-06-18 20:45:53.151 FINE: REQUEST HEADERS: {Accept=text/html, image/png, image/jpeg, image/gif, */*, Accept-Encoding=gzip, deflate, User-Agent=JOSM/1.5 (18746 en_GB) Mac OS X 12.6.6 Java/17.0.7}
2023-06-18 20:45:53.167 INFO: GET https://pkk.rosreestr.ru/GISWebServiceSE/service.php?SERVICE=WMTS&REQUEST=GetTile&VERSION=3.0.0&LAYER=PKKm&STYLE=default&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX=6&TILEROW=34&TILECOL=55&FORMAT=image%2Fpng -> !!! (18 ms)
}}}

If however you choose a pre-defined imagery source with custom http headers (like `Geoportal 2: Orthophotomap (aerial image) WMTS` for Poland), custom headers are sent correctly.

==== Please provide any additional information below. Attach a screenshot if possible.

{{{
Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2023-06-02 17:23:29 +0200 (Fri, 02 Jun 2023)
Revision:18746
Build-Date:2023-06-03 01:31:02
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (18746 en_GB) Mac OS X 12.6.6
OS Build number: macOS 12.6.6 (21G646)
Memory Usage: 696 MB / 16384 MB (429 MB allocated, but free)
Java version: 17.0.7+7-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: javax.swing.plaf.metal.MetalLookAndFeel
Screen: Display 5 2560×1440 (scaling 2.00×2.00)
Maximum Screen Size: 2560×1440
Best cursor sizes: 16×16→16×16, 32×32→32×32
System property file.encoding: UTF-8
System property sun.jnu.encoding: UTF-8
Locale info: en_GB
Numbers with default locale: 1234567890 -> 1234567890
Program arguments: [--debug]
Dataset consistency test: No problems found

Plugins:
+ reverter (36066)
+ tageditor (36079)
+ turnlanes-tagging (0.0.5)
+ undelete (36066)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/HiDPISupport&zip=1
- https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip

Last errors/warnings:
- 00065.867 W: java.net.ConnectException: Connection refused
- 00068.328 W: JCS - Silent failure during download: https://pkk.rosreestr.ru/GISWebServiceSE/service.php?SERVICE=WMTS&REQUEST=GetTile&VERSION=3.0.0&LAYER=PKKm&STYLE=default&TILEMATRIXSET=GoogleMapsCompatible&TILEMATRIX=15&TILEROW=10109&TILECOL=19784&FORMAT=image%2Fpng
- 00172.525 W: java.net.ConnectException: Connection refused
- 00172.525 W: Already here java.net.ConnectException: Connection refused
- 00208.097 W: java.net.ConnectException: Connection refused
- 00215.015 W: java.net.ConnectException: Connection refused
- 00215.020 W: java.net.ConnectException: Connection refused
- 00215.025 W: java.net.ConnectException: Connection refused
- 00225.179 W: java.net.ConnectException: Connection refused
- 00396.598 W: java.net.ConnectException: Connection refused
}}}
"	defect	closed	normal	23.06	Core		fixed	template_report	
