http: tell the parser about CONNECT responses by slushie · Pull Request #6198 · nodejs/node
jasnell
added
the
semver-minor
label
Apr 15, 2016This commit fixes a bug in HTTP CONNECT response parsing. The parser normally continues to look for additional HTTP messages after the first message has completed. However, in the case of CONNECT responses, the parser should stop looking for additional messages and treat any further data as a separate protocol. Because of the way that HTTP messages are parsed in JavaScript, this bug only manifests itself in the case where the socket's `data' handler receives the end of the response message *and also* includes non-HTTP data. In order to implement the fix, an `.upgrade' accessor is exposed to JavaScript on the HTTPParser object that proxies the underlying http_parser's `upgrade' field. Likewise in JavaScript, the `http' client module sets this value to `true' when a response is received to a CONNECT request. The result of this is that callbacks on HTTPParser instances can signal that the message indicates a change in protocol and further HTTP parsing should not occur.
indutny added a commit to indutny/http-parser that referenced this pull request
Apr 16, 2016Returning `2` from on_headers_complete will tell parser that it should not expect neither a body nor any futher responses on this connection. This is useful for handling responses to a CONNECT request which may not contain `Upgrade` or `Connection: upgrade` headers. See: nodejs/node#6198
indutny added a commit to nodejs/http-parser that referenced this pull request
Apr 19, 2016Returning `2` from on_headers_complete will tell parser that it should not expect neither a body nor any futher responses on this connection. This is useful for handling responses to a CONNECT request which may not contain `Upgrade` or `Connection: upgrade` headers. See: nodejs/node#6198 PR-URL: #299 Reviewed-By: Brian White <mscdex@mscdex.net>
indutny added a commit to indutny/io.js that referenced this pull request
Apr 19, 2016Adds `2` as a return value of `on_headers_complete`, this mode will be used to fix handling responses to `CONNECT` requests. See: nodejs#6198
indutny added a commit to indutny/io.js that referenced this pull request
Apr 19, 2016When handling a response to `CONNECT` request - skip message body and do not attempt to parse the next message. `CONNECT` requests are used in similar sense to HTTP Upgrade. Fix: nodejs#6198
indutny added a commit that referenced this pull request
Apr 19, 2016MylesBorins pushed a commit that referenced this pull request
Apr 21, 2016MylesBorins pushed a commit that referenced this pull request
Apr 21, 2016joelostrowski pushed a commit to joelostrowski/node that referenced this pull request
Apr 25, 2016Adds `2` as a return value of `on_headers_complete`, this mode will be used to fix handling responses to `CONNECT` requests. See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request
Apr 25, 2016When handling a response to `CONNECT` request - skip message body and do not attempt to parse the next message. `CONNECT` requests are used in similar sense to HTTP Upgrade. Fix: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request
Apr 25, 2016See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request
Apr 26, 2016jasnell pushed a commit that referenced this pull request
Apr 26, 2016jasnell pushed a commit that referenced this pull request
Apr 26, 2016indutny added a commit to indutny/io.js that referenced this pull request
Jun 28, 2016Adds `2` as a return value of `on_headers_complete`, this mode will be used to fix handling responses to `CONNECT` requests. See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
indutny added a commit to indutny/io.js that referenced this pull request
Jun 28, 2016When handling a response to `CONNECT` request - skip message body and do not attempt to parse the next message. `CONNECT` requests are used in similar sense to HTTP Upgrade. Fix: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
indutny pushed a commit to indutny/io.js that referenced this pull request
Jun 28, 2016See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request
Jul 5, 2016Adds `2` as a return value of `on_headers_complete`, this mode will be used to fix handling responses to `CONNECT` requests. See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request
Jul 5, 2016When handling a response to `CONNECT` request - skip message body and do not attempt to parse the next message. `CONNECT` requests are used in similar sense to HTTP Upgrade. Fix: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request
Jul 5, 2016See: nodejs#6198 PR-URL: nodejs#6279 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request
Jul 11, 2016MylesBorins pushed a commit that referenced this pull request
Jul 11, 2016MylesBorins pushed a commit that referenced this pull request
Jul 11, 2016MylesBorins pushed a commit that referenced this pull request
Jul 12, 2016MylesBorins pushed a commit that referenced this pull request
Jul 12, 2016MylesBorins pushed a commit that referenced this pull request
Jul 12, 2016This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters