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
supporting HTTP/2. #399
supporting HTTP/2. #399
Conversation
Whoa, awesome! Will review now. |
I got the following when trying to test this:
|
I can't say I understand the details going on here, but I'm OK with merging once I can compile and run the test suite on Windows. |
Very cool. I don't have anything to add but I was able to compile and On Tue, Jul 14 2015, Kazu Yamamoto notifications@github.com wrote:
|
connSendMany = TLS.sendData ctx . L.fromChunks | ||
, connSendAll = sendall | ||
, connSendFile = sendfile | ||
, connClose = close | ||
, connRecv = recv | ||
, connRecv = recv ref | ||
, connRecvBuf = recvBuf ref |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document the ref, recvBuf or recv functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Network.Wai.Handler.Warp.Types
says:
-- | The connection receiving function. This returns "" for EOF.
, connRecv :: Recv
-- | The connection receiving function. This tries to fill the buffer.
-- This returns when the buffer is filled or reaches EOF.
, connRecvBuf :: RecvBuf
ref
implements a cache for leftover input data.
@snoyberg |
@snoyberg I remembered that older "http2" does not provide |
Awesome work, @kazu-yamamoto! This bit worried me:
Then I read the source code: the 10 worker threads are per connection, not global :). So the only concern should be resource usage. Perhaps |
On another thought... it doesn't look like |
@meteficha Yes, 10 workers are spawn per HTTP/2 connection. |
@snoyberg Does the current version still fail on Windows? |
I'll test tomorrow, sorry for the delay. On Wed, Jul 15, 2015, 5:14 PM Kazu Yamamoto notifications@github.com
|
No problem. You waited for me. I can wait for you. |
Windows build went without problems using stack (needed to add http2 and hex packet to extra-deps) with lts-2.9 (ghc-7.8.4). Are there any tests which specifically target the new protocol? |
No. I have not implemented HTTP/2 client side. So, I cannot automate testing at this moment. Rather, I manually test the HTTP/2 feature with Firefox, h2spec and nghttp as mentioned above. |
Looks good on Windows (a few test failures, but nothing that doesn't exist on Windows). I think this is good to be merged, go for it when you're ready! W00t! Congratulations Kazu, awesome work 👍 |
Thanks. Merged. Now I have an idea to spawn worker threads dynamically. I will implement it today. |
I changed the version of warp-tls to 3.1.0. @snoyberg Please revert this if you don't like this. I also updated the documents of warp and warp-tls so that they explicitly mention HTTP/2. |
That's perfect. Should we release this to Hackage, perhaps with a caveat On Thu, Jul 16, 2015, 6:01 PM Kazu Yamamoto notifications@github.com
|
Let's release Warp 3.1.0 and WarpTLS 3.1.0 in the next week. I will write a blog article in advance. |
Cool, feel free to do so yourself, or just ping me and I'll do the release. On Thu, Jul 16, 2015 at 6:10 PM Kazu Yamamoto notifications@github.com
|
Done in fedab88. |
@kazu-yamamoto Do you know exactly which sha1 was uploaded to Hackage as Warp-3.1? Was it 70fa8a6 ? I want to tag it for helping some testing in the |
@creichert Sorry. I forgot to push tags. I did now. |
Thanks! On Tue, Jul 28 2015, Kazu Yamamoto notifications@github.com wrote:
|
This patch implements HTTP/2 (RFC 7540).
This code passes the following three tests:
-- All test cases provided by h2spec
-- Test cases provided by nghttp
-- Field test in the real web world
Recent Firefox and Chrome supports HTTP/2 over TLS. With this patch, WarpTLS automatically communicates with Firefox and Chrome in HTTP/2. There is no settings to disable HTTP/2 at this moment. We should implement them if necessary.
The following picture illustrates rough architecture:
In HTTP/2, multiple streams are asynchronously sent over a TCP connection.
One concern: the number of worker threads in the worker pool is now hard coded -- 10. Unlike ResponseFile and ResponseBuilder, ResponseStream occupies the worker thread. So, if 10 streamings are served, no worker is available. We should fix this if necessary.
@snoyberg Please review and merge this if you think OK.