HTTP Request Headers

When a user types a URL into the Web client and “sends it on its way” to fetch a Web page, the Web client uses that URL to create an HTTP request header. This request header is sent to the Web server, which then decodes the header and sends back an appropriate HTTP reply.

I provided many examples of simple request headers in Appendix B, “Response Codes and Reason Phrases.” They consisted of a single GET line. Request headers can be far more complex and extensive than that. Here is the header that my Netscape Web client produced when I asked it to fetch the root index at a fictitious Web site:

 GET / HTTP/1.0 Connection: Keep-Alive User-Agent: Mozilla/4.04 [en] (WinNT; U) Host: www.mywebsite.com Accept: image/gif, image/x-xbitmap, ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.