O'Reilly logo

Node Web Development by David Herron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cookie handling

Another important feature is cookie support. The HTTP protocol is stateless, meaning that the web server doesn't know the identity of one requester from the identity of another requester. How then can we "log in" to a website if the protocol doesn't support any concept of state? The normal way is for a web server to send cookies to the browser, including cookies which identify the person who is logged in. Web browsers send cookies related to websites they're visiting on every request.

The Basic Server includes partial support for recognizing cookies sent by the browser. The request handler scans through the headers in the req object, identifying any Cookie headers, saving them into an array (http://en.wikipedia.org/wiki/HTTP_Cookie ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required