HTTP is a stateless protocol because every HTTP request is independent of and

Http is a stateless protocol because every http

This preview shows page 77 - 80 out of 517 pages.

HTTP is a stateless protocol because every HTTP request is independent of and unrelated to all previous requests. A web app that keeps track of “where you are” (Have you logged in yet? What step of the checkout process are you on?) must have its own mechanisms for doing so, since nothing about an HTTP request remembers this information. HTTP cookies associate a particular user’s browser with information held at the server corresponding to that user’s session , but it is the browser’s responsibility, not HTTP’s or the SaaS app’s, to make sure the right cookies are included with each HTTP request. Stateless protocols therefore simplify server design at the expense of application design, but happily, successful frameworks such as Rails shield you from much of this complexity. Screencast 2.2.1: Cookies SaaS frameworks simplify working with cookies, which are used to establish that two independent
Image of page 77
requests actually originated from the same user’s browser, and can therefore be thought of as part of a session. On the first visit to a site, the server includes a long string (up to 4 KBytes) with the Set- Cookie: HTTP response header. It is the browser’s responsibility to include this string with the Cookie: HTTP request header on subsequent requests to that site. The cookie string, which is usually not encrypted but is protected by a “fingerprint” or message authentication code , contains enough information for the server to associate the request with the same user session. We can now express what’s happening when you load the RottenPotatoes home page in slightly more precise terms, as Figure 2.4 shows. Figure 2.4: At 50,000 feet, we can expand Step 1 from Figure 2.1 . To drill down further, we’ll next look at how the content itself is represented. Summary Web browsers and servers communicate using the HyperText Transfer Protocol . HTTP relies on TCP/IP (Transmission Control Protocol/Internet Protocol) to reliably exchange ordered sequences of bytes. Each computer connected to a TCP/IP network has an IP address such as, although the Domain Name System (DNS) allows the use of human-friendly names instead. The special name localhost refers to the local computer and resolves to the special IP address Each application running on a particular computer must “listen” on a distinct TCP port , numbered from 1 to 65535 (2 16 -1). Port 80 is used by HTTP (Web) servers. To run a SaaS app locally, you activate an HTTP server listening on a port on localhost . WEBrick, Rails’ lightweight server, uses port 3000. A Uniform Resource Identifier (URI) names a resource available on the Internet. The interpretation of the resource name varies from application to application. HTTP is a stateless protocol in that every request is independent of every other request, even from the same user. HTTP cookies allow the association of HTTP requests from the same user. It’s the browser’s responsibility to accept a cookie from an HTTP server and ensure that the cookie is included with future requests sent to that server.
Image of page 78
ELABORATION: Client Pull vs. Server Push.
Image of page 79
Image of page 80

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors