public final class Host extends HeaderString
The domain name of the server (for virtual hosting), and the TCP port number on which the server is listening. The port number may be omitted if the port is the standard port for the service requested. Mandatory since HTTP/1.1.
Host: en.wikipedia.org:8080 Host: en.wikipedia.org
Host = "Host" ":" host [ ":" port ] ; Section 3.2.2
A "host" without any trailing port information implies the default port for the service requested (e.g., "80" for an HTTP URL). For example, a request on the origin server for <http://www.w3.org/pub/WWW/> would properly include:
GET /pub/WWW/ HTTP/1.1 Host: www.w3.org
A client MUST include a Host header field in all HTTP/1.1 request messages. If the requested URI does not include an Internet host name for the service being requested, then the Host header field MUST be given with an empty value. An HTTP/1.1 proxy MUST ensure that any request message it forwards does contain an appropriate Host header field that identifies the service being requested by the proxy. All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message which lacks a Host header field.
See sections 5.2 and 19.6.1.1 for other requirements relating to Host.
Modifier and Type | Method and Description |
---|---|
static Host |
forString(String value)
Returns a parsed
Host header. |
asString, eq, eqIC, toString
Copyright © 2018 Apache. All rights reserved.