3

Although I've been developing web applications for close on 6 years now I still do not know what happens when a request reaches the server. I am looking for book that works through what happens when a request reaches the server and how the server knows which code to call. I'm assuming that there is a old book from the early eighties/nineties, when the internet was still relatively new to developers, that would be able to explain this; but my google-fu is failing me in my search for this book.

Whether the book deals with IIS or Apache, I think it would be quite interesting to read and may be useful to know so any recommendations are welcome. Thank you

StevenMcD
  • 141
  • 6

4 Answers4

5

You should start by reading the following documents: RFC 2616 (HTTP/1.1), RFC 793 (TCP), RFC 791 (IP), and RFC 826 (ARP). All of the above RFCs are available via the w3.org web site. Douglas Comer's book is also a good reference.

bit-twiddler
  • 2,648
  • 1
  • 16
  • 17
  • 2
    thanks, will look into these. Want to give the question a little more time for accepting an answer. +1 though – StevenMcD Mar 23 '11 at 14:43
  • The RFCs listed above detail the procotols that are used to communicate with a web server. HTML is enveloped inside of HTTP request/response pairs. HTTP is enveloped inside of TCP packets in order guarantee end-to-end delivery. TCP packets are routed through a network inside of IP packets. ARP is used to resolve IP to machine address translations. The subnet mask is used to determine which machine to ARP. If the source and destination addresses match after the subnet mask is xored with the IP address, It means that we are on the same logical data link, and we can use ARP to resolve the – bit-twiddler Mar 23 '11 at 15:00
  • (cont) machine's physical machine address. However, if the source and destination addresses do not match, we are on separate data links and have to go through a router; therefore, we use ARP to resolve the router's physical link address. The term "stack" in the web app development world comes from the networking world. – bit-twiddler Mar 23 '11 at 15:00
3

I see that the full text of the O'Reilley book Web Client Programming in Perl is online, now that the book is out of print.

Chapter 3 of that book is what really taught me, in as simple language as possible, what's going on under the covers of an HTTP request. Not a word of perl on that page, so don't worry about that, and it starts high-level and drills down to concepts like caching and authentication. It's very nicely done.

Dan Ray
  • 9,106
  • 3
  • 37
  • 49
1

Write a web server. A basic one is a fairly simple project that shouldnt take you more than a couple weeks doing it as a hobby project. You will learn a lot about whats going on under the hood, plus build some understanding of basic socket programming.

GrandmasterB
  • 37,990
  • 7
  • 78
  • 131
0

I don't know of any book, but beyond basic sockets, you could further do some research on the HTTP protocol, then if you're ASP.NET inclined I recommend touching on ISAPI then finding a good, deep read on the ASP.NET pipeline.

Your basic web server uses a socket to listen on port 80 (or whatever) and parse HTTP verbs from the stream of text received on that port, then write an appropriate response to that port.

ProfK
  • 502
  • 2
  • 13
  • BSD Sockets is just an API that wraps the TCP/IP protocol stack. In order to understand what sockets does, one needs to learn the TCP/IP protocol stack. The TCP/IP protocol stack is defined in a set of documents known as RFCs. – bit-twiddler Mar 23 '11 at 15:10