-
-
Notifications
You must be signed in to change notification settings - Fork 1
Parts of the HTTP header
Greg Bowler edited this page Nov 3, 2017
·
5 revisions
HTTP headers consist of the following shape:
A B C
X: Y
The first line of HTTP headers is called the "Header Start Line" and consist of three values, separated by spaces. The values A B and C consist of the following:
For a request header:
- A = Method - what type of request this is, e.g.
POST
- B = Path - the part of the URI that comes after the host, e.g.
/index.html
- C = Protocol - which version of HTTP is being requested, e.g.
HTTP/2.0
For a response header:
- A = Protocol - which version of HTTP the response is being served in, e.g.
HTTP/2.0
- B = Status code - a numeric code relating to the type of response, e.g.
404
- C = Status message - a textual representation of the status code, e.g.
NOT FOUND
After the first line comes an optional area called the "Header Fields" (historically referred to as the "Header Entity") which consists of any number of key-value-pairs.
- X = The key of the entity line, e.g.
Host
- Y = The value of the entity line, e.g.
example.com
Each entity line (Y) is a string and can represent multiple values separated by semicolons, e.g. text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
Please see the HTTP message specification for more information: https://tools.ietf.org/html/rfc7230#section-3