The first line of the HTTP request is called the request line and consists of 3 parts:
- The “method” indicates what kind of request this is. Most common methods are GET, POST and HEAD.
- The “path” is generally the part of the url that comes after the host (domain). For example, when requesting “http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/” , the path portion is “/tutorials/other/top-20-mysql-best-practices/”.
- The “protocol” part contains “HTTP” and the version, which is usually 1.1 in modern browsers.
The remainder of the request contains HTTP headers as “Name: Value” pairs on each line. These contain various information about the HTTP request and your browser. For example, the “User-Agent” line provides information on the browser version and the Operating System you are using. “Accept-Encoding” tells the server if your browser can accept compressed output like gzip.
You may have noticed that the cookie data is also transmitted inside an HTTP header. And if there was a referring url, that would have been in the header too.
Most of these headers are optional. This HTTP request could have been as small as this:
- GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1
- Host: net.tutsplus.com
And you would still get a valid response from the web server.
Super text, super blog, eeeee =)
ОтветитьУдалить"The first line of the HTTP request is called the request line and consists of 3 parts" - it's true.
ОтветитьУдалить