If you really want to know this stuff, you want to look at the RFCs for the HTTP protocol. If you just want to write code that gets these values on the server properly, just use
CGI which already takes care of these things. There are other modules that do such, too.