Closed
Description
The documentation for the Host field of a net/http Request reads: // The host on which the URL is sought. // Per RFC 2616, this is either the value of the Host: header // or the host name given in the URL itself. Host string This is somewhat ambiguous, as the Host: header may contain the :port suffix too (RFC 2616, sec 14.23), but the URL's host component definitely does not include the port component (RFC 2396, sec 3.2.2). So is this field supposed to be: (a) just the host name, for vanity/virtual hosting purposes (RFC 2616, sec 5.2)? In this case, the docstring should read: // ...this is either the value of the host component of the Host: header ... and the implementation should parse the Host: header. or (b) the host with optional :port, i.e. the server authority? In this case the docstring should read: // ... or the host name and optional port given in the URL itself. and the implementation should include the url.Port component. The docstring should probably also include the word "authority" for bonus marks. Personally I think (b) is more useful. RFC sec 14.23 defines the Host: header as the server authority.