Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace C HTTP parser with JS HTTP parser #1457

Closed
wants to merge 67 commits into from

Commits on Jun 21, 2015

  1. Configuration menu
    Copy the full SHA
    fc2378f View commit details
    Browse the repository at this point in the history
  2. doc: update http documentation

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    67b0e62 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6b0ead3 View commit details
    Browse the repository at this point in the history
  4. http: improve parser performance

    * Relax header value and status reason parsing
    
    * Avoid using RegExp for folded line detection
    
    * Use faster: string trimming, case-insensitive string comparing,
    CRLF searching, and case-insensitive header value searching
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    9dd9560 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    eb3d679 View commit details
    Browse the repository at this point in the history
  6. http: remove unused variable

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    4e37fcc View commit details
    Browse the repository at this point in the history
  7. http: fix max chunk size string len

    Anything more than 14 hex characters definitely has a larger value
    than our max chunk size.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    fd6c127 View commit details
    Browse the repository at this point in the history
  8. http: use faster NaN check

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    6a1e157 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    2e63483 View commit details
    Browse the repository at this point in the history
  10. benchmark: fix V8 warmup for http parser benchmarks

    I think it's more accurate to "warm up" the one parser instance
    instead of creating many new throw-away instances since instances
    are typically reused in core.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    1ead648 View commit details
    Browse the repository at this point in the history
  11. http: fix comment typo

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    b254753 View commit details
    Browse the repository at this point in the history
  12. benchmark: improve http parser benchmark more

    This increases the loop count for the timed region and removes
    a couple of unlikely inputs.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    2c4ebc2 View commit details
    Browse the repository at this point in the history
  13. http: style change

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    f5ba8cf View commit details
    Browse the repository at this point in the history
  14. http: remove chunk size string length checking

    This was initially designed to verify we didn't have more digits
    than JavaScript can handle, but it's erroneously reporting errors
    when there are chunk extensions on the same line. The check's
    usefulness is semi-questionable anyway, so let's remove it for now.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    f4d786e View commit details
    Browse the repository at this point in the history
  15. http: remove unused variable

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    455ea89 View commit details
    Browse the repository at this point in the history
  16. http: allow double quotes and non-ASCII bytes in request URI

    As the comments explain, these are not technically allowed, but
    since joyent/http-parser previously allowed them, we support them
    for better backwards compatibility.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    237e8d5 View commit details
    Browse the repository at this point in the history
  17. http: improve comment wording

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    48e1dc7 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    ade4029 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    d3b4976 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    6ee84a8 View commit details
    Browse the repository at this point in the history
  21. http: fix whitespace preservation if folding is encountered

    Addtitionally this re-checks special headers in case the values we
    check for were on folded lines.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    766c731 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    234864a View commit details
    Browse the repository at this point in the history
  23. http: fix keepalive check

    This should now directly reflect how joyent/http-parser does
    keepalive checking.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    b59f4f1 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    a332c74 View commit details
    Browse the repository at this point in the history
  25. http: ensure first byte is printable ASCII

    This helps detect bad input early to prevent a "hung" state where
    the parser keeps looking for a CRLF. Generally this shouldn't be an
    issue, but could happen if TLS handshaking data is mistakenly
    written to the parser for example.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    9a7f8d5 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    ac584b9 View commit details
    Browse the repository at this point in the history
  27. http: remove duplicate code

    Typically the functions that return Error objects already have
    set the internal error state, so there is no need to do it twice.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    382b12c View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    8d5d474 View commit details
    Browse the repository at this point in the history
  29. http: fix typo

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    a5194be View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    434e1bb View commit details
    Browse the repository at this point in the history
  31. http: lint and style changes

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    6e0c6ba View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    8d56d59 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    2728b9d View commit details
    Browse the repository at this point in the history
  34. benchmark: style change

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    f35d9dd View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    fb64bd1 View commit details
    Browse the repository at this point in the history
  36. http: use max js int value - 1 for content/chunk lengths

    Before this it was possible that a Content-Length or chunk length
    of 9007199254740993 to be interpreted as 9007199254740992,
    making it impossible to know that the value was larger than our
    maximum. Using maximum js int value - 1 allows us to reliably detect
    when the max length has been exceeded.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    9bc7d5c View commit details
    Browse the repository at this point in the history
  37. http: remove unnecessary internal state variable

    The folded state is no longer needed since we are now always
    deferring trimming of header values until the next new header or
    the end of the headers, whichever comes first.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    686ced1 View commit details
    Browse the repository at this point in the history
  38. http: lint

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    b53d285 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    db67814 View commit details
    Browse the repository at this point in the history
  40. http: fix keepalive support

    This mainly fixes parsing of successive similar message types when
    there is a fixed-length body.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    7f8bf45 View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    b0b0950 View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    543afe7 View commit details
    Browse the repository at this point in the history
  43. Configuration menu
    Copy the full SHA
    05c3baa View commit details
    Browse the repository at this point in the history
  44. http: remove unused variables

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    6b8afe5 View commit details
    Browse the repository at this point in the history
  45. http: move keepalive boolean to flag

    This improves performance some by not having to (re)set another
    instance property.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    86b6bda View commit details
    Browse the repository at this point in the history
  46. http: avoid parsing '1'/'0'

    The ternary expression is faster, but may not be noticeable.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    cfb7f3e View commit details
    Browse the repository at this point in the history
  47. http: lint and style changes

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    ae19bae View commit details
    Browse the repository at this point in the history
  48. http: reduce property lookups

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    6879858 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    f6c134f View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    f5197ae View commit details
    Browse the repository at this point in the history
  51. Configuration menu
    Copy the full SHA
    ede7529 View commit details
    Browse the repository at this point in the history
  52. Configuration menu
    Copy the full SHA
    61e1b0b View commit details
    Browse the repository at this point in the history
  53. test: move http parser durability test to pummel

    These tests take significantly longer to execute.
    Also the http 0.9 test has been corrected to reflect the capability
    of the current js parser.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    f7c90ff View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    05480ac View commit details
    Browse the repository at this point in the history
  55. http: switch to regexp-less, LF-compatible js parser

    See this[1] comment for more details and benchmark results.
    
    Notable changes:
     * Removed all regexps. Only request URLs are not validated
    currently.
     * Added globally configurable start line length limits
     * Chunk size parsing no longer line buffers
     * Lines can end in just LF too
     * Faster than the original regexp-based implementation
    
    [1] nodejs#1457 (comment)
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    c48053a View commit details
    Browse the repository at this point in the history
  56. http: fix comment style

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    b7ee346 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    d97942b View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    79e2d60 View commit details
    Browse the repository at this point in the history
  59. http: validate request url

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    526b24f View commit details
    Browse the repository at this point in the history
  60. test: fix typo

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    950582a View commit details
    Browse the repository at this point in the history
  61. test: port URL tests from joyent/http-parser

    This only tests basic URL validation because the JS HTTP parser
    does not actually parse the URL into its individual parts.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    3a870f1 View commit details
    Browse the repository at this point in the history
  62. http: move property initialization to prototype

    This bumps the large-alternate parser benchmark to ~19k+, making it
    match the result from joyent/http-parser 2.5.0.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    d3247f1 View commit details
    Browse the repository at this point in the history
  63. Configuration menu
    Copy the full SHA
    fb32e80 View commit details
    Browse the repository at this point in the history
  64. http: switch to regexp search for longer field names

    Somewhere between 10 and 14 characters, the equalsLower()
    algorithm becomes slower than searching with a simple,
    case-insensitive, non-anchored regexp.
    
    This at least gives a consistently higher bump in the
    large-alternate parser benchmark.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    4af63d7 View commit details
    Browse the repository at this point in the history
  65. http: remove parser pause()/resume() usage

    The js parser pause()/resume() are no-ops anyway.
    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    7ba6c2b View commit details
    Browse the repository at this point in the history
  66. test: update comment

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    3da4427 View commit details
    Browse the repository at this point in the history
  67. lib,test: fix lint issues

    mscdex committed Jun 21, 2015
    Configuration menu
    Copy the full SHA
    d56a9f0 View commit details
    Browse the repository at this point in the history