senchalabs/connect — pull request #838 by jonathanong (2013-07-02 04:00:31+00:00)
Title: lazily parse cookies in cookieParser and cookieSession

this is an over-optimization, but there are cases when you don't want to populate or parse sessions or cookies, such as when you're mixing a regular website with a REST API.

caveats:

the only backward compatibility breakage is when people use `cookieParser()` or `cookieSession()` and expect cookie headers to be sent even though they don't use `req.session` or `req.cookies || req.signedCookies`. i'm not sure how big of a problem this is because i actually see this as a feature.

if there is an error when parsing a cookie, `next(err)` will be called, but because the cookie is parsed outside of the stack, there's a chance for double callbacks. i'm going to make a separate pull requests to ensure double callbacks do not exist for `next(err)`s.