kazu-yamamoto / http2

HTTP/2.0 library including HPACK
BSD 3-Clause "New" or "Revised" License
86 stars 22 forks source link

things to do #3

Closed kazu-yamamoto closed 8 years ago

kazu-yamamoto commented 10 years ago

@bbangert I'm satisfied with the current code for framing. I will finish the frame test cases today and merge the "frame" branch to "master".

Then, I will go to another project for a while. When I come back, I will implements modules to send/receive frames so that the http2 library can be used to communicate the current HTTP/2 implementations.

Currently, I have no idea on how to map Haskell threads to HTTP/s connections/frames. But I will start with very naive implementation. (Probably, you have such experience on web sockets.)

bbangert commented 10 years ago

It probably depends on how and where the integration occurs.

For example, for 'normal' HTTP/2 support in something like Warp, I would expect every new stream to result in a new Haskell thread call to a configured WAI handler. This generally would result in similar resource usage compared to how pipelining and multiple requests are done currently. The only other change would be that the WAI handler will need a 'magic' function somewhere to allow it to send PUSH PROMISE's with their content.

Alternatively, apparently the Java webserver folks have rigged up their HTTP/2 server such that it keeps some basic heuristics of commonly fetched asset URL's after an HTML page is sent, and then will PUSH those later for the same request. This requires some additional tracking data for HTML pages, but seems like a more elegant/powerful solution that doesn't require ppl making webapps to overthink Push resources, as the server will notice the assets needed for the page and push those on its own.

For my usage, I plan on implementing a HTTP/2 reverse-proxy, so resource usage will be a priority and will be tracking streams/connections in a different manner.

kazu-yamamoto commented 10 years ago

Yeah. I'm thinking the 'magic' function including frame queuing, such and such.

bbangert commented 10 years ago

Are the tests supposed to pass? I get this:

HPACK
  decodeRequestHeader
    - decodes headers in request FAILED [1]

1) HPACK.decodeRequestHeader decodes headers in request
uncaught exception: IOException (test-hpack/hpack-test-case: getDirectoryContents: does not exist (No such file or directory))

Randomized with seed 792088143

Finished in 0.0019 seconds
1 example, 1 failure
Test suite hpack: FAIL
Test suite logged to: dist/test/http2-0.5.0-hpack.log
Test suite frame: RUNNING...

Frame
  decodeFrame and encodeFrame
    - decodes test cases well FAILED [1]

1) Frame, decodeFrame and encodeFrame, decodes test cases well
uncaught exception: PatternMatchFail (test-frame/JSON.hs:164:1-71: Non-exhaustive patterns in function parsePayload
)

Randomized with seed 1738596225

Finished in 0.0078 seconds
1 example, 1 failure
Test suite frame: FAIL
Test suite logged to: dist/test/http2-0.5.0-frame.log
2 of 4 test suites (2 of 4 test cases) passed.
kazu-yamamoto commented 10 years ago

I have just pushed the final commits. Please try again.

bbangert commented 10 years ago

Ah, that got rid of the Frame error, still have the same HPACK test error.

kazu-yamamoto commented 10 years ago

The documentation is poor, sorry.

You need to git clone https://github.com/http2jp/hpack-test-case.git in the test-hpack/ dir.

bbangert commented 10 years ago

Ok, that got it closer, now I get this error:

    - decodes headers in request FAILED [1]

1) HPACK.decodeRequestHeader decodes headers in request
expected: Nothing
 but got: Just "test-hpack/hpack-test-case/hyper-hpack/story_00.json: Headers are different in 82870388f439ce75c875fa5786:\nRight [Indexed 2,Indexed 7,Literal NotAdd (Idx 3) \"yahoo.co.jp\",Indexed 6]\n[(\":method\",\"GET\"),(\":scheme\",\"http\"),(\":authority\",\"yahoo.co.jp\"),(\":path\",\"/\")]\n[(\":method\",\"GET\"),(\":scheme\",\"https\"),(\":method\",\"yahoo.co.jp\"),(\":scheme\",\"http\")]"

Randomized with seed 951431225
kazu-yamamoto commented 10 years ago

Nobody maintain hyper-hpack, node-http2-protocol and twitter-hpack. They are old. Please just remove these directory. "draft" in JSON MUST be 9 (i.e. HPACK-09) now.

kazu-yamamoto commented 10 years ago

@bbangert did you pass all tests?

bbangert commented 10 years ago

Yup, deleting those dirs did the trick, thanks!