http2-client 0.2.0.0 → 0.2.0.1
raw patch · 3 files changed
+38/−23 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +25/−13
- http2-client.cabal +1/−1
- src/Network/HTTP2/Client.hs +12/−9
README.md view
@@ -2,6 +2,8 @@ An native-Haskell HTTP2 client library based on `http2` and `tls` packages. +Hackage: https://hackage.haskell.org/package/http2-client .+ ## General design HTTP2 is a heavy protocol. HTTP2 features pipelining, query and responses@@ -29,17 +31,37 @@ one at a time. We look forward to the linear arrows extension for improving the library design. +### Versioning and GHC support++We try to follow https://pvp.haskell.org/ as `a.b.c.d` with the caveat that if+`a=0` then we are still slightly unhappy with some APIs and we'll break things+arbitrarily.++We aim at supporting GHC-8.x, contributions to support GHC-7.x are welcome.++### Installation++This package is a standard `Stack` project, please also refer to Stack's+documentation if you have trouble installing or using this package. Please+also have a look at the Hackage Matrix CI:+https://matrix.hackage.haskell.org/package/http2-client .+ ## Usage First, make sure you are somewhat familiar with HTTP and HTTP2 standards by reading RFCs or Wikipedia pages. If you use the library, feel free to shoot me an e-mail (cf. commits) or a tweet @lucasdicioccio . -### Installation+### Help and examples -This package is a standard `Stack` project, please also refer to Stack's-documentation if you have trouble installing or using this package.+We currently provide a command-line example client: `http2-client-exe` which I+use as a test client and you could use to test various flow-control parameters.+Read `app/Main.hs` and `src/Network/HTTP2/Client/Helpers.hs` to look at how a+user application is implemented. +The Haddocks should have plenty implementation details, so please have a look.+Otherwise, you can ask help by creating an Issue on the bug-tracker.+ ### Opening a stream First, you open a (TLS-protected) connection to a server and configure the@@ -116,16 +138,6 @@ Fortunately, changing settings mid-stream is probably a rare behavior and the default SETTINGS are large enough to avoid creating fatal errors before sending/receiving the initial SETTINGS frames.--## Help and examples--We currently provide a command-line example client: `http2-client-exe` which I-use as a test client and you could use to test various flow-control parameters.-Read `app/Main.hs` and `src/Network/HTTP2/Client/Helpers.hs` to look at how a-user application is implemented.--The Haddocks should have plenty implementation details, so please have a look.-Otherwise, you can ask help by creating an Issue on the bug-tracker. ## Things that are hardcoded
http2-client.cabal view
@@ -1,5 +1,5 @@ name: http2-client-version: 0.2.0.0+version: 0.2.0.1 synopsis: A native HTTP2 client library. description: Please read the README.md at the homepage. homepage: https://github.com/lucasdicioccio/http2-client
src/Network/HTTP2/Client.hs view
@@ -351,7 +351,7 @@ -> IORef ConnectionSettings -> Chan (FrameHeader, Either e FramePayload) -> Chan (FrameHeader, StreamId, Either ErrorCode HeaderList)- -> Chan (StreamId, StreamId)+ -> Chan (StreamId, Chan (FrameHeader, Either e FramePayload), StreamId) -> HpackEncoderContext -> StreamId -> (Http2Stream -> StreamDefinition a)@@ -388,11 +388,11 @@ let _rst = sendResetFrame frameStream let _prio = sendPriorityFrame frameStream let _waitPushPromise ppHandler = do- (_,ppSid) <- waitPushPromiseWithParentStreamId sid pushPromises+ (_,ppFrames,ppSid) <- waitPushPromiseWithParentStreamId sid pushPromises let mkStreamActions stream = StreamDefinition (return CST) (ppHandler sid stream) ppCont <- initializeStream conn settings- serverFrames+ ppFrames serverHeaders serverPushPromises hpackEncoder@@ -476,7 +476,7 @@ :: Exception e => Chan (FrameHeader, Either e FramePayload) -> Chan (FrameHeader, StreamId, Either ErrorCode HeaderList)- -> Chan (StreamId, StreamId)+ -> Chan (StreamId, Chan (FrameHeader, Either e FramePayload), StreamId) -> DynamicTable -> IO () incomingHPACKFramesLoop frames headers pushPromises hpackDecoder = forever $ do@@ -487,8 +487,11 @@ frames (sId, pattern) <- case fp of PushPromiseFrame sid hbf -> do+ -- Important: We duplicate the channel here or we risk losing+ -- DATA frames sent over the stream.+ ppChan <- dupChan frames let parentSid = HTTP2.streamId fh- writeChan pushPromises (parentSid, sid)+ writeChan pushPromises (parentSid, ppChan, sid) return (sid, Right hbf) HeadersFrame _ hbf -> -- TODO: handle priority return (HTTP2.streamId fh, Right hbf)@@ -749,13 +752,13 @@ waitPushPromiseWithParentStreamId :: StreamId- -> Chan (StreamId, StreamId)- -> IO (StreamId, StreamId)+ -> Chan (StreamId, Chan (FrameHeader, Either e0 FramePayload), StreamId)+ -> IO (StreamId, Chan (FrameHeader, Either e0 FramePayload), StreamId) waitPushPromiseWithParentStreamId sid chan = loop where loop = do- pair@(parentSid,_) <- readChan chan+ tuple@(parentSid,_,_) <- readChan chan if parentSid == sid- then return pair+ then return tuple else loop