The following is a guest post by Li Ouyang and originally appeared on her blog. Li is currently a student a The Flatiron School. You can learn more about her here, or follow her on twitter here. You can find the part 1 in this series here. We’ll be publishing the final post when it is released.
Thanks to Tim Berners-Lee we have the internet. Information is literally at our fingertips, expanding our capablities to superhuman-like powers. Why? Because we no longer have to recreate the wheel. There are nuggets of information scattered through out the internet, showing us the path to the solutions we seek. Enough of why the internet is so bombastically awesome. Let’s talk about the how.
Your browser sends a request to the server at the IP address. The server sends a response back. Your browser renders the page. You can now facebook stalk whomever you want. It’s a give and take relationship.
The Anatomy of a Request A request is composed of three things: the URL, the method, and headers, containing information about the browser. In reality, to render any page, there are multiple requests happening. The text of a page is one request. The ability to have pretty jquery effects is another request. And even the css formatting of the page is another request.
Different Methods There are 4 out of the 9 that you’ll hear people talk about: GET, POST, PUT, DELETE. If you think of a web page as a database, you can describe all database functionality with these verbs. This is also known as CRUD (Create, Read, Update, Delete). The method describes what kind of request you’re sending.
The Anatomy of a Reponse
The response is composed of an HTTP status code, the body of the response, and headers with more information.
In the example to the right, the server responded with a 200 status code, which means request has succeeded! If you’ve ever received a 500 status code, it means there was an internal server error, and it’s not your computer.
The body of the reponse is the plain HTML the server is sending back to your browser.
Thanks to my friend, Ray, we’ll be exploring how the browser renders HTML next!
Make yourself useful.