http2 5.3.1 → 5.3.2
raw patch · 4 files changed
+21/−12 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Network.HTTP2.Server.Internal: [sioWriteBytes] :: ServerIO -> ByteString -> IO ()
- Network.HTTP2.Server.Internal: ServerIO :: SockAddr -> SockAddr -> IO (StreamId, Stream, Request) -> (Stream -> Response -> IO ()) -> (ByteString -> IO ()) -> ServerIO
+ Network.HTTP2.Server.Internal: ServerIO :: SockAddr -> SockAddr -> IO (a, Request) -> (a -> Response -> IO ()) -> ServerIO a
- Network.HTTP2.Server.Internal: [sioMySockAddr] :: ServerIO -> SockAddr
+ Network.HTTP2.Server.Internal: [sioMySockAddr] :: ServerIO a -> SockAddr
- Network.HTTP2.Server.Internal: [sioPeerSockAddr] :: ServerIO -> SockAddr
+ Network.HTTP2.Server.Internal: [sioPeerSockAddr] :: ServerIO a -> SockAddr
- Network.HTTP2.Server.Internal: [sioReadRequest] :: ServerIO -> IO (StreamId, Stream, Request)
+ Network.HTTP2.Server.Internal: [sioReadRequest] :: ServerIO a -> IO (a, Request)
- Network.HTTP2.Server.Internal: [sioWriteResponse] :: ServerIO -> Stream -> Response -> IO ()
+ Network.HTTP2.Server.Internal: [sioWriteResponse] :: ServerIO a -> a -> Response -> IO ()
- Network.HTTP2.Server.Internal: data ServerIO
+ Network.HTTP2.Server.Internal: data ServerIO a
- Network.HTTP2.Server.Internal: runIO :: ServerConfig -> Config -> (ServerIO -> IO (IO ())) -> IO ()
+ Network.HTTP2.Server.Internal: runIO :: ServerConfig -> Config -> (ServerIO Stream -> IO (IO ())) -> IO ()
Files
- ChangeLog.md +6/−0
- Network/HTTP2/H2/Sender.hs +9/−3
- Network/HTTP2/Server/Run.hs +5/−8
- http2.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,11 @@ # ChangeLog for http2 +## 5.3.2++* Avoid unnecessary empty data frames at end of stream+ [#140](https://github.com/kazu-yamamoto/http2/pull/140)+* Removing unnecessary API from ServerIO+ ## 5.3.1 * Fix treatment of async exceptions
Network/HTTP2/H2/Sender.hs view
@@ -282,17 +282,23 @@ _ reqflush = do let buf = confWriteBuffer `plusPtr` off- off' = off + frameHeaderLength + datPayloadLen (mtrailers, flag) <- do Trailers trailers <- tlrmkr Nothing if null trailers then return (Nothing, setEndStream defaultFlags) else return (Just trailers, defaultFlags)- fillFrameHeader FrameData datPayloadLen streamNumber flag buf+ -- Avoid sending an empty data frame before trailers at the end+ -- of a stream+ off' <-+ if datPayloadLen /= 0 || isNothing mtrailers then do+ decreaseWindowSize ctx strm datPayloadLen+ fillFrameHeader FrameData datPayloadLen streamNumber flag buf+ return $ off + frameHeaderLength + datPayloadLen+ else+ return off off'' <- handleTrailers mtrailers off' _ <- sync Nothing halfClosedLocal ctx strm Finished- decreaseWindowSize ctx strm datPayloadLen if reqflush then do flushN off''
Network/HTTP2/Server/Run.hs view
@@ -56,14 +56,13 @@ ---------------------------------------------------------------- -data ServerIO = ServerIO+data ServerIO a = ServerIO { sioMySockAddr :: SockAddr , sioPeerSockAddr :: SockAddr- , sioReadRequest :: IO (StreamId, Stream, Request)- , sioWriteResponse :: Stream -> Response -> IO ()+ , sioReadRequest :: IO (a, Request)+ , sioWriteResponse :: a -> Response -> IO () -- ^ 'Response' MUST be created with 'responseBuilder'. -- Others are not supported.- , sioWriteBytes :: ByteString -> IO () } -- | Launching a receiver and a sender without workers.@@ -71,7 +70,7 @@ runIO :: ServerConfig -> Config- -> (ServerIO -> IO (IO ()))+ -> (ServerIO Stream -> IO (IO ())) -> IO () runIO sconf conf@Config{..} action = do ok <- checkPreface conf@@ -81,7 +80,7 @@ ctx@Context{..} <- setup sconf conf lnch let get = do (strm, inpObj) <- atomically $ readTQueue inpQ- return (streamNumber strm, strm, Request inpObj)+ return (strm, Request inpObj) putR strm (Response OutObj{..}) = do case outObjBody of OutBodyBuilder builder -> do@@ -90,14 +89,12 @@ out = OHeader outObjHeaders (Just next) outObjTrailers enqueueOutput outputQ $ Output strm out sync _ -> error "Response other than OutBodyBuilder is not supported"- putB bs = enqueueControl controlQ $ CFrames Nothing [bs] serverIO = ServerIO { sioMySockAddr = confMySockAddr , sioPeerSockAddr = confPeerSockAddr , sioReadRequest = get , sioWriteResponse = putR- , sioWriteBytes = putB } io <- action serverIO concurrently_ io $ runH2 conf ctx
http2.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: http2-version: 5.3.1+version: 5.3.2 license: BSD3 license-file: LICENSE maintainer: Kazu Yamamoto <kazu@iij.ad.jp>