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

HTTP/2 server #687

Merged
merged 104 commits into from
Nov 19, 2023
Merged

HTTP/2 server #687

merged 104 commits into from
Nov 19, 2023

Commits on Jun 30, 2023

  1. Configuration menu
    Copy the full SHA
    e1bebcd View commit details
    Browse the repository at this point in the history
  2. Re-indent safe-execute as a body macro

    Update some deprecated usages
    Refactored some names for clarity
    KingMob committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    b67c250 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1deac6e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    9070415 View commit details
    Browse the repository at this point in the history
  5. Move http2 pipeline setup to a.h.http2 ns

    The connection-level http2 pipelines are almost identical between client
    and server, because they're just setting up the frame codec and the
    multiplex handler.
    KingMob committed Jun 30, 2023
    Configuration menu
    Copy the full SHA
    21e9dbd View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2023

  1. Setup conn-level pipeline

    Created top-level server pipeline building fns
    Refactored out executor setup fns
    KingMob committed Jul 1, 2023
    Configuration menu
    Copy the full SHA
    02095f2 View commit details
    Browse the repository at this point in the history
  2. Replaced slow, ad hoc date formatting with Netty fns

    Netty has an optimized formatter
    Keeps 1s scheduled executor updates
    KingMob committed Jul 1, 2023
    Configuration menu
    Copy the full SHA
    2bd5198 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2023

  1. Configuration menu
    Copy the full SHA
    b3338de View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2023

  1. Minor refactoring and docstrings

    Bumped up Netty to 4.1.96
    KingMob committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    3a1a149 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    70fad2c View commit details
    Browse the repository at this point in the history
  3. Fix unnecessary continue-executor shutdown

    If `continue-executor` is same as main executor .shutdown gets called
    twice. Probably harmless, but also pointless.
    KingMob committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    4e7cd03 View commit details
    Browse the repository at this point in the history
  4. Simplified common header generation

    Switch to `common/date-header-value` for HTTP/1
    KingMob committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    2bda782 View commit details
    Browse the repository at this point in the history
  5. Update server params for setup-http1-pipeline

    pipeline and handler now part of opts map
    KingMob committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    c5c143c View commit details
    Browse the repository at this point in the history
  6. Update and fix HTTP/2 header handling

    `ring-map->netty-http2-headers` now handles both requests and responses
    correctly.
    
    Use AsciiString/String consistently when comparing
    Remove unneeded null check for header values (Netty will do it)
    Updated add-header docstring
    KingMob committed Jul 29, 2023
    Configuration menu
    Copy the full SHA
    87a3411 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    1e98ffa View commit details
    Browse the repository at this point in the history

Commits on Jul 31, 2023

  1. Ignore .pem files

    KingMob committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    463b424 View commit details
    Browse the repository at this point in the history
  2. WIP

    KingMob committed Jul 31, 2023
    Configuration menu
    Copy the full SHA
    f16147e View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2023

  1. Configuration menu
    Copy the full SHA
    3a03056 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2023

  1. Configuration menu
    Copy the full SHA
    97fda5c View commit details
    Browse the repository at this point in the history
  2. Minor cleanup

    Add add-exception-handler to common to log exception that make it to the
    end of the pipeline.
    Rename attach-idle-handlers to add-idle-handlers to match the rest of
    the system.
    Move error-response and invalid-value-exception to common ns
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    b748c92 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a35226a View commit details
    Browse the repository at this point in the history
  4. Update TLS return type hints

    Hint ssl-handler with SslHandler, not ChannelHandler
    Hint coerce-ssl-context with SslContext
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    7ad1b8c View commit details
    Browse the repository at this point in the history
  5. Switch to BoringSSL for local dev

    Fix SSL test when using BoringSSL
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    23503a1 View commit details
    Browse the repository at this point in the history
  6. Add a lot of logging

    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    ded4f0f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    275cd30 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    04eee02 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    18f4ec6 View commit details
    Browse the repository at this point in the history
  10. Convert :scheme pseudo-header to string

    `keyword` doesn't work with CharSequences
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    877f7ad View commit details
    Browse the repository at this point in the history
  11. Close the circuit - http2 server now sending

    Basic GET/HEAD requests work
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    787f40f View commit details
    Browse the repository at this point in the history
  12. Update project.clj

    Bump byte-streams to 0.3.4
    
    Raise io.netty.util log level. It generates a lot of distracting logs.
    KingMob committed Aug 30, 2023
    Configuration menu
    Copy the full SHA
    35c6093 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    21e4b44 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    02ac0a8 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    ed61b85 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    30feb0a View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2023

  1. Configuration menu
    Copy the full SHA
    4522f13 View commit details
    Browse the repository at this point in the history
  2. Alter final pipeline error handling

    Instead of automatically closing, make final error handler in charge,
    if it exists.
    
    If not, continue to fire exception along pipeline. (Preferable to closing?)
    KingMob committed Aug 31, 2023
    Configuration menu
    Copy the full SHA
    01f0cbc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5230389 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    30e4f91 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2023

  1. Improve pr support for AsciiStrings

    Now uses succinct AS"some string" format
    KingMob committed Sep 1, 2023
    Configuration menu
    Copy the full SHA
    472254f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7f9ad2a View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2023

  1. Minor doc updates

    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    b155a4a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cc0ebc4 View commit details
    Browse the repository at this point in the history
  3. Convert util fns to use ChannelOutboundInvoker

    Since both Channels and ChannelHandlerContext inherit from
    ChannelOutboundInvoker, use that for the type hint, instead of manually
    checking class ourselves.
    
    Next: inline
    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    e4b6b17 View commit details
    Browse the repository at this point in the history
  4. Update add-exception-handler to close and not propagate

    Meant to be final exception handler in a pipeline. No point in
    propagating further, just results in Netty logging.
    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    522c275 View commit details
    Browse the repository at this point in the history
  5. If client-handler's channel goes inactive, set (or try to) complete t…

    …o true
    
    If the channel closed unexpectedly, set complete to true to tell client
    to dispose of the connection.
    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    72d4ae1 View commit details
    Browse the repository at this point in the history
  6. Add stream-ex helper fn

    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    9969937 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    41c6f9e View commit details
    Browse the repository at this point in the history
  8. Add go-away fn

    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    2c708dc View commit details
    Browse the repository at this point in the history
  9. Add header validation and status parsing

    Parse response status
    Check for mandatory pseudo-headers
    
    As of Netty 4.1.96, the presence of mandatory pseudo-headers doesn't
    seem to be checked, just their values, when present.
    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    71cbb3e View commit details
    Browse the repository at this point in the history
  10. Update imports

    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    3cc3ca1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    caa0baf View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    467f76a View commit details
    Browse the repository at this point in the history
  13. Replace server handler complete

    Replace with writable? and h2-exception. complete is needed for client,
    not server.
    
    writable? is checked before calling send-response
    KingMob committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    e449ce2 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    9fdf1b9 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    f6188c0 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2023

  1. Improve handling of GOAWAY and RST_STREAM

    Support user-supplied go-away-handler and reset-stream-handler
    Set writable? false when called.
    Do not propagate event further.
    Extract out handle-shutdown-frame
    KingMob committed Sep 27, 2023
    Configuration menu
    Copy the full SHA
    c01d583 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2023

  1. Improve error handling

    Add goaway and reset handlers for client
    Set status to 200 if missing, for backwards-compatibility with http1 code
    
    Refactor out common goaway/reset code
    
    Re-enable request header validation
    
    Move http2-client-handler to http2 ns
    KingMob committed Oct 2, 2023
    Configuration menu
    Copy the full SHA
    4c5891c View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2023

  1. Configuration menu
    Copy the full SHA
    4eb6cf6 View commit details
    Browse the repository at this point in the history
  2. Refactor stream-ex to support public error messages

    Too many params, switched to map
    KingMob committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    83d0bea View commit details
    Browse the repository at this point in the history
  3. Server handler now sends a 400 resp for stream errors

    When aleph-error-handler (and .exceptionCaught) are called, now tries to
    send a 400 response before sending RST_STREAM.
    KingMob committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    0ec4a5b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    67da7a6 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1b3a1d4 View commit details
    Browse the repository at this point in the history
  6. Fix bug where conn-ex-handler closed indiscrimantely

    By calling close on th conn channel, GOAWAYs are sent, but without
    regard to any associated H2 error codes.
    KingMob committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    e1f56f8 View commit details
    Browse the repository at this point in the history
  7. Consolidated H2 exception code betw server and client

    Add reset-stream fn
    
    Add netty/write-fut that returns a promise. By default, netty/write uses
    a void promise for speed.
    
    Rename send-http-error-response -> write-http-error-response, and have
    it return promise
    KingMob committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    0f1facd View commit details
    Browse the repository at this point in the history
  8. Flush in client-handler read-complete

    Theoretically better for flow control
    KingMob committed Oct 3, 2023
    Configuration menu
    Copy the full SHA
    30e792f View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8960435 View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2023

  1. Configuration menu
    Copy the full SHA
    f972047 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e85f983 View commit details
    Browse the repository at this point in the history
  3. Refactored write-http-error-response

    Replaced with write-simple-http-mesg
    Made body-text/error message optional
    
    Fixed status parsing bug when :aleph/response-status was set to nil
    KingMob committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    7afb9a0 View commit details
    Browse the repository at this point in the history
  4. Fix bug in redirect tests

    Caused by using http/request directly and not using *pool*
    KingMob committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    890d566 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    75e9e81 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ac49918 View commit details
    Browse the repository at this point in the history
  7. Support :max-request-body-size in HTTP2 code

    Add max-size-handler
    KingMob committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    9eb0123 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2023

  1. Update request timeout test

    Moves the sleep from the body to before the return of the Ring map.
    
    Unlike the HTTP1 code, the H2 code can respond as soon as it gets a
    header, which prevents the request timeout from triggering.
    
    Also adds a 1.5s delay to server shutdown, so repeating tasks like
    (date-header-value) can finish and not throw exceptions.
    KingMob committed Oct 6, 2023
    Configuration menu
    Copy the full SHA
    37543fb View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Move idle handlers to netty ns

    Fix circular ns issue
    Not just applicable to HTTP, anyway
    KingMob committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    2b4732e View commit details
    Browse the repository at this point in the history
  2. Update HTTP server docstrings

    KingMob committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    456aa8b View commit details
    Browse the repository at this point in the history
  3. Fix idle timeout error

    Update the client :channel-inactive method in H2 to set the response-d
    to closed, in order to mimic HTTP1 behavior
    
    In HTTP1 code, when the client channel is closed, it closes the responses
    stream, which leads the take! to get ::closed.
    
    Also replace ::closed with :aleph/closed, so it can be used in other nses
    KingMob committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    5a30b59 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Fix bug caused by closing already-closed client chan

    Trying to close an already-closed channel on the client-side caused an
    exception, when it should be idempotent.
    KingMob committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    642bcbc View commit details
    Browse the repository at this point in the history
  2. Fix bug in HTTP2 handling of client-pool

    The HTTP2 code didn't use the :on-closed callback like the HTTP1 code
    did. As a result, closed connections weren't automatically being
    disposed of in the connection pool, but reused, which leads to immediate
    failures.
    
    The HTTP1 code attached the on-closed cb to the responses stream, but H2
    doesn't need a stream. The code now attaches the close cb to the Netty
    Channel's close Future. This should be safe, tho there may be some churn
    in Dirigiste.
    
    (Also realiased confusing aleph.ssl in tests to test-ssl)
    KingMob committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    15a8a24 View commit details
    Browse the repository at this point in the history
  3. Minor changes

    Remove nonexistent :socket-timeout option in tests
    Add Channel id to print output
    Add TODOs
    Increase io.netty.channel logging level to warn
    Add more tracing
    KingMob committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    c24a073 View commit details
    Browse the repository at this point in the history
  4. Made some tests HTTP1

    Some tests are very specific to either HTTP1 semantics or Aleph's HTTP1
    implementation.
    KingMob committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    023569f View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2023

  1. Expand pipeline transformation options

    Also add common/ssl-ctx-supports-http2? fn
    KingMob committed Oct 21, 2023
    Configuration menu
    Copy the full SHA
    d91ccce View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    48c1548 View commit details
    Browse the repository at this point in the history
  3. Set default to HTTP/1 only

    KingMob committed Oct 21, 2023
    Configuration menu
    Copy the full SHA
    8adefc5 View commit details
    Browse the repository at this point in the history
  4. Support backwards compatibility

    Targets public 0.4.6 vars
    
    Does not support netty/headers
    KingMob committed Oct 21, 2023
    Configuration menu
    Copy the full SHA
    c61d6f1 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2023

  1. Parity between HTTP1 and HTTP2 header retrieval

    HTTP1's HeaderMap enabled the use of keywords and case-insensitivity for
    header retrieval (but not assoc/dissoc).
    
    This copies HeaderMap to the HTTP2 code base. Unfortunately, Netty's
    HTTP1 header class is outside the later Header hierarchy, and can't be
    shared.
    
    Ensures HeaderMap always returns a String value
    
    Fix bug where get-all and extract-cookies-from-response-headers were
    HTTP1-only
    
    Fix bug where AsciiString's broke retrieval when passed to `name`
    
    Remove unneeded netty-http2-headers->map
    
    Also HeadersMap is 5x faster than prev H2 solution
    KingMob committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    f0a7234 View commit details
    Browse the repository at this point in the history
  2. Netty 4.1.100.Final

    KingMob committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    a181e12 View commit details
    Browse the repository at this point in the history
  3. Add Brotli and Zstd deps to dev profile

    Required to compile support for them
    KingMob committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    0ad1654 View commit details
    Browse the repository at this point in the history
  4. Add testutils ns

    Add AsciiString-aware str= equality fn
    KingMob committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    9b201c0 View commit details
    Browse the repository at this point in the history
  5. Add HTTP/2 compression support

    H2 compression is not well-supported by Netty for its multiplex setup,
    only its older single-pipeline H2 classes.
    
    It happens in two parts: (1) decorators are attached to the
    Http2FrameCodec that handle the actual de/compression, and (2) a handler
    that parses and updates the *-encoding headers is added to each stream
    pipeline.
    
    Adds new `compression-options` for both H1/H2, and deprecates
    `compression-level` to H1-only, like Netty.
    KingMob committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    4a5fc81 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2023

  1. Add profile... profile

    Add a Lein profile for performance testing. Just clj-async-profiler for
    now, but should support more libs in the future
    KingMob committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    ee4e626 View commit details
    Browse the repository at this point in the history
  2. WIP on H2 examples

    KingMob committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    5583d22 View commit details
    Browse the repository at this point in the history
  3. Merge master into feature/http2-server

    Rebase failed, too divergent
    KingMob committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    9a37528 View commit details
    Browse the repository at this point in the history
  4. Fix bug when using map for :ssl-context

    Broke validate-http1-pipeline-xform
    KingMob committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    45dca06 View commit details
    Browse the repository at this point in the history
  5. Fix bugs in SSL cert ID tests

    Ensure tests can always override default options
    KingMob committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    996c6c2 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2023

  1. Fix Clojure compiler bug with optional compression classes

    The Clojure compiler cannot distinguish between static methods and fields
    without reflection. This causes ClassNotFoundExceptions when loading
    Netty's StandardCompressionOptions class, even if optional code paths
    are guarded.
    
    Add AlephCompressionOptions, a class that exists solely to relay calls
    to StandardCompressionOptions without triggering CNFEs.
    KingMob committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    56360c8 View commit details
    Browse the repository at this point in the history
  2. Add HTTP/2 examples

    KingMob committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    36108d6 View commit details
    Browse the repository at this point in the history
  3. Bump deps

    KingMob committed Nov 4, 2023
    Configuration menu
    Copy the full SHA
    ec9e6a9 View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2023

  1. Configuration menu
    Copy the full SHA
    2eb16ba View commit details
    Browse the repository at this point in the history

Commits on Nov 7, 2023

  1. Configuration menu
    Copy the full SHA
    f074c88 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d19ef5b View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2023

  1. Addressed Moritz's feedback

    KingMob committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    d10e30e View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. Configuration menu
    Copy the full SHA
    e1969aa View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2023

  1. Address Moritz's feedback

    go-away and reset-stream now public
    Updated docstrings and comments
    Print inline handler warning only once now
    Switch frame-list from atom to volatile!, since it's thread-bound
    KingMob committed Nov 19, 2023
    Configuration menu
    Copy the full SHA
    335875a View commit details
    Browse the repository at this point in the history