The HTTP protocol is what powers todays web. While not useful for most people, knowing how HTTP works is important for those who work with dynamic web sites.
Still, it seems that the protocol is mostly a mystery to a lot of developers and some features of the protocol, such as the accept-language header, aren’t really used.
Why is HTTP knowledge important
Without understanding HTTP, how can you understand the browser?
You need to understand the workings of HTTP for a lot of things: Redirection, finding out where the user came from, finding the user’s IP and finding the users language to name a few.
How can you perform the above tasks if you don’t know where to get the information and what it means?
At some point in your life, you may even have to deal with writing a simple HTTP server.
Today most libraries and such can abstract away the dirty details, but I feel that this can make the programmer get a false sense of security. What if your library has a bug? This is of course unlikely, but it’s something where actually understanding how the thing works behind the scenes is important.
I believe that knowing how, not just why something happens, is very important.
You’re in luck, because the HTTP protocol is quite simple.
I think the most important part for web-developers to understand are the HTTP headers. They are what you will often have to deal with, as languages like PHP abstract the other details away.
HTTP headers in PHP are accessed by using the $_SERVER superglobal. The reserved variables page of the PHP manual has a list of them.
The best resource for learning about the protocol itself, and about things like HTTP status codes such as 404 and 200, is the HTTP rfc.
Why does everyone (including me!) call HTTP the HTTP protocol? I mean the P in HTTP stands for Protocol – The HyperText Transfer Protocol Protocol?