For the "how does the web work question", the real question is if you are really interested in knowing that, if so "Computer Networking: A Top-Down Approach" gives a really in depth analysis of protocols at the different levels of abstraction. Otherwise most web related O'Reilly books cover the surface of what you need to know to develop applications at most small corporations.