hummingbird-project / hummingbird-examples

Examples demonstrating various aspects of the Hummingbird swift server framework
Apache License 2.0
86 stars 19 forks source link

Testing with addHTTP2Upgrade #41

Closed davidjohannesbotha closed 11 months ago

davidjohannesbotha commented 11 months ago

Hi all,

This might not actually be a bug, but the documentation is not complete, so I thought I would post it here. My HB server is using the addHTTP2Upgrade, and all works in the 'production' settting. However, with the addHTTP2Upgrade, for all tests (even the simplest endpoints such as:

self.router.get("/") { _ in
            return "Hello"
        }

the test fails. The tests succeed without the addHTTP2Upgrade, but I would really like to test all my endpoints with this enabled. The test fails with the following log message: /Library/Developer/Xcode/DerivedData/HummingbirdServer-cqscixbrudpxqncfbsfmyuaasefc/SourcePackages/checkouts/swift-nio/Sources/NIOCore/EventLoopFuture.swift:1284: error: -[AppTests.AppTests testCreate] : failed: caught error: "alreadyClosed".

Once again, sorry if this is not the place mention this issue.

Kind regards David

adam-fowler commented 11 months ago

Hmm not a totally helpful error message.

The HummingbirdXCT test client doesn't support HTTP2. To test it you would have to use AsyncHTTPClient which does support HTTP2. And then connect with a TLSConfiguration where certificateVerification is set to either .none or .noHostnameVerification.

adam-fowler commented 11 months ago

So I created this to test HTTP2 and TLS https://github.com/hummingbird-project/hummingbird-xct-async-http-client

And found shutdown of HTTP2 isn't working too great. I need to talk the swift-nio guys to find out the best way to resolve this.

adam-fowler commented 11 months ago

Fixed shutdown of HTTP2 in v1.6 of HummingbirdCore