The port number inside the Host header is always USHRT_MAX (i.e., 65535) when no explicit port was set in the URL. This causes many webservers to return the wrong website (or a 404 response therefore) when they manage multiple name-based virtual hosts.
This patch handles URLs without explicit port correctly and does not add any explicit port number to the Host header when the URL also contains none. I chose not to set any explicit port in that case, because an explicit port 80 (or 443) can also cause trouble with virtual hosts.
The port number inside the
Host
header is alwaysUSHRT_MAX
(i.e., 65535) when no explicit port was set in the URL. This causes many webservers to return the wrong website (or a 404 response therefore) when they manage multiple name-based virtual hosts.This patch handles URLs without explicit port correctly and does not add any explicit port number to the
Host
header when the URL also contains none. I chose not to set any explicit port in that case, because an explicit port 80 (or 443) can also cause trouble with virtual hosts.