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

http2: backport changes to v9.x-staging #18050

Closed
wants to merge 27 commits into from

Commits on Jan 9, 2018

  1. src: add optional keep-alive object to SetImmediate

    Adds the possibility to keep a strong persistent reference to
    a JS object while a `SetImmediate()` call is in effect.
    
    PR-URL: nodejs#17183
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    1724a4e View commit details
    Browse the repository at this point in the history
  2. http2: don't call into JS from GC

    Calling into JS land from GC is not allowed, so delay
    the resolution of pending pings when a session is destroyed.
    
    PR-URL: nodejs#17183
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    df31133 View commit details
    Browse the repository at this point in the history
  3. http2: only schedule write when necessary

    Introduce an `Http2Scope` class that, when it goes out of scope,
    checks whether a write to the network is desired by nghttp2.
    If that is the case, schedule a write using `SetImmediate()`
    rather than a custom per-session libuv handle.
    
    PR-URL: nodejs#17183
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    8c28e30 View commit details
    Browse the repository at this point in the history
  4. http2: be sure to destroy the Http2Stream

    PR-URL: nodejs#17406
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    504ee24 View commit details
    Browse the repository at this point in the history
  5. http2: cleanup Http2Stream/Http2Session destroy

    PR-URL: nodejs#17406
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    
    This is a significant cleanup and refactoring of the
    cleanup/close/destroy logic for Http2Stream and Http2Session.
    There are significant changes here in the timing and ordering
    of cleanup logic, JS apis. and various related necessary edits.
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    ac89b78 View commit details
    Browse the repository at this point in the history
  6. http2: remove redundant write indirection

    `nghttp2_stream_write_t` was not a necessary redirection layer
    and came with the cost of one additional allocation per stream write.
    
    Also, having both `nghttp2_stream_write` and `nghttp2_stream_write_t`
    as identifiers did not help with readability.
    
    PR-URL: nodejs#17718
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    7ab5c62 View commit details
    Browse the repository at this point in the history
  7. http2: refactor outgoing write mechanism

    - Only finish outgoing `WriteWrap`s once data has actually been
      passed to the underlying socket.
      - This makes HTTP2 streams respect backpressure
    - Use `DoTryWrite` as a shortcut for sending out as much of
      the data synchronously without blocking as possible
    - Use `NGHTTP2_DATA_FLAG_NO_COPY` to avoid copying DATA frame
      contents into nghttp2’s buffers before sending them out.
    
    PR-URL: nodejs#17718
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    66be8e5 View commit details
    Browse the repository at this point in the history
  8. http2: convert Http2Settings to an AsyncWrap

    PR-URL: nodejs#17763
    Refs: nodejs#17746
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    293c2f9 View commit details
    Browse the repository at this point in the history
  9. http2: fix compiling with --debug-http2

    PR-URL: nodejs#17863
    Fixes: nodejs#17840
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    08478c1 View commit details
    Browse the repository at this point in the history
  10. http2: keep session objects alive during Http2Scope

    Keep a local handle as a reference to the JS `Http2Session`
    object so that it will not be garbage collected
    when inside an `Http2Scope`, because the presence of the
    latter usually indicates that further actions on
    the session object are expected.
    
    Strictly speaking, storing the `session_handle_` as a
    property on the scope object is not necessary, but
    this is not very costly and makes the code more
    obviously correct.
    
    Fixes: nodejs#17840
    
    PR-URL: nodejs#17863
    Fixes: nodejs#17840
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    addaleax authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    b61c3fc View commit details
    Browse the repository at this point in the history
  11. http2: implement ref() and unref() on client sessions

    PR-URL: nodejs#17620
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    kjin authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    afa4a7c View commit details
    Browse the repository at this point in the history
  12. http2: remove duplicate words in comments

    PR-URL: nodejs#17939
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    tniessen authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    8d8dfea View commit details
    Browse the repository at this point in the history
  13. http2: perf_hooks integration

    Collect and report basic timing information about `Http2Session`
    and `Http2Stream` instances.
    
    PR-URL: nodejs#17906
    Refs: nodejs#17746
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    d968c02 View commit details
    Browse the repository at this point in the history
  14. http2: strictly limit number on concurrent streams

    Strictly limit the number of concurrent streams based on the
    current setting of the MAX_CONCURRENT_STREAMS setting
    
    PR-URL: nodejs#16766
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    bf7eed3 View commit details
    Browse the repository at this point in the history
  15. http2: add altsvc support

    Add support for sending and receiving ALTSVC frames.
    
    PR-URL: nodejs#17917
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    8df5d02 View commit details
    Browse the repository at this point in the history
  16. tls: set servername on client side too

    PR-URL: nodejs#17935
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    ae4e308 View commit details
    Browse the repository at this point in the history
  17. http2: add initial support for originSet

    Add new properties to `Http2Session` to identify alpnProtocol,
    and indicator about whether the session is TLS or not, and
    initial support for origin set (preparinng for `ORIGIN` frame
    support and the client-side `Pool` implementation.
    
    The `originSet` is the set of origins for which an `Http2Session`
    may be considered authoritative. Per the `ORIGIN` frame spec,
    the originSet is only valid on TLS connections, so this is only
    exposed when using a `TLSSocket`.
    
    PR-URL: nodejs#17935
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Sebastiaan Deckers <sebdeckers83@gmail.com>
    Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    7d6aa20 View commit details
    Browse the repository at this point in the history
  18. http2: add aligned padding strategy

    Add a padding strategy option that makes a best attempt to ensure
    that total frame length for DATA and HEADERS frames are aligned
    on multiples of 8-bytes.
    
    PR-URL: nodejs#17938
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    760f678 View commit details
    Browse the repository at this point in the history
  19. http2: properly handle already closed stream error

    PR-URL: nodejs#17942
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    06ed513 View commit details
    Browse the repository at this point in the history
  20. doc: add docs for common/http2.js utility

    PR-URL: nodejs#17942
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    e929bd0 View commit details
    Browse the repository at this point in the history
  21. src: silence http2 -Wunused-result warnings

    PR-URL: nodejs#17954
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    cjihrig authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    c1c4a6c View commit details
    Browse the repository at this point in the history
  22. http2: implement maxSessionMemory

    The maxSessionMemory is a cap for the amount of memory an
    Http2Session is permitted to consume. If exceeded, new
    `Http2Stream` sessions will be rejected with an
    `ENHANCE_YOUR_CALM` error and existing `Http2Stream`
    instances that are still receiving headers will be
    terminated with an `ENHANCE_YOUR_CALM` error.
    
    PR-URL: nodejs#17967
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    adbc38a View commit details
    Browse the repository at this point in the history
  23. http2: verify that a dependency cycle may exist

    PR-URL: nodejs#17968
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    51dc318 View commit details
    Browse the repository at this point in the history
  24. doc: grammar fixes in http2.md

    PR-URL: nodejs#17972
    Reviewed-By: Weijia Wang <starkwang@126.com>
    Reviewed-By: Jon Moss <me@jonathanmoss.me>
    Reviewed-By: Evan Lucas <evanlucas@me.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Trott authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    d1e75eb View commit details
    Browse the repository at this point in the history
  25. http2: verify flood error and unsolicited frames

    * verify protections against ping and settings flooding
    * Strictly handle and verify handling of unsolicited ping and
      settings frame acks.
    
    PR-URL: nodejs#17969
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    jasnell authored and MylesBorins committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    cd6fcf3 View commit details
    Browse the repository at this point in the history
  26. doc: correct spelling

    PR-URL: nodejs#17911
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Rich Trott <rtrott@gmail.com>
    Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
    Reviewed-By: Tobias Nießen <tniessen@tnie.de>
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
    Reviewed-By: Weijia Wang <starkwang@126.com>
    sreepurnajasti authored and jasnell committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    526cf84 View commit details
    Browse the repository at this point in the history
  27. perf_hooks: fix scheduling regression

    Scheduling a PerformanceGCCallback should not keep the
    loop alive but due to the recent switch to using the
    native SetImmediate method, it does. Go back to using
    uv_async_t and add a regression test.
    
    PR-URL: nodejs#18051
    Fixes: nodejs#18047
    Refs: nodejs#18020
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    apapirovski authored and jasnell committed Jan 9, 2018
    Configuration menu
    Copy the full SHA
    d7dd941 View commit details
    Browse the repository at this point in the history