Feature request #21659
Remove the default (80/443) port number from Host header in HTTP/HTTPS requests
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Network | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 29475 |
Description
QGIS does not remove the default port number from HTTP/HTTPS requests "Host" header (in particular for WMS/WMTS/WFS/WCS GetCapabilities/GetMap/GetFeature/GetCoverage... requests) when the URL provided by the user (or taken from the service capabilities) explicitly contains the default port number.
On the other hand, some of the most common web client, namely cURL, Wget, Chrome, Firefox, Safari and also GDAL/OGR tools, remove the port number from "Host" header in HTTP/HTTPS GET/PUT requests if the port number is the default one for the protocol (i.e. 80 for HTTP and 443 for HTTPS) even if the URL explicitly contains the said default port number; they insert the port number in the request "Host" header only if it is not the default one for the protocol.
The port number in the Host header, in fact, is optional and is not needed if it is the default one [1].
That QGIS (not really wrong) behaviour leads to various problems in properly retrieve capabilities/maps/tiles/features/coverages/legends/... from OGC WEB Services hosted by some servers (see #21380 and [2]).
It would be useful if QGIS removed (or didn't insert) the port number in (at least) HTTP/HTTPS requests "Host" header when the port number is the default one for the protocol.
[1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23 - https://tools.ietf.org/html/rfc7230#section-5.4 - https://tools.ietf.org/html/rfc3986#section-3.2.3
[2] (it_IT) "Servizio WMS del SIT Regione Lazio su QGIS. Considerazioni varie" http://osgeo-org.1560.x6.nabble.com/Servizio-WMS-del-SIT-Regione-Lazio-su-QGIS-Considerazioni-varie-td5399043.html