File tree Expand file tree Collapse file tree 6 files changed +42
-2
lines changed
Expand file tree Collapse file tree 6 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,17 @@ module Network.HTTP2.Client (
7171 rstRateLimit ,
7272
7373 -- * Common configuration
74- Config (.. ),
74+ Config ,
75+ defaultConfig ,
76+ confWriteBuffer ,
77+ confBufferSize ,
78+ confSendAll ,
79+ confReadN ,
80+ confPositionReadMaker ,
81+ confTimeoutManager ,
82+ confMySockAddr ,
83+ confPeerSockAddr ,
84+ confReadNTimeout ,
7585 allocSimpleConfig ,
7686 allocSimpleConfig' ,
7787 freeSimpleConfig ,
Original file line number Diff line number Diff line change 11module Network.HTTP2.Client.Internal (
22 Request (.. ),
33 Response (.. ),
4+ Config (.. ),
45 ClientConfig (.. ),
56 Settings (.. ),
67 Aux (.. ),
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import Control.Exception (
1414 )
1515import qualified Control.Exception as E
1616import Data.IORef
17+ import Foreign.Ptr (nullPtr )
1718import Network.Control
1819import Network.HTTP.Semantics.Client
1920import Network.HTTP.Semantics.IO
@@ -272,6 +273,22 @@ data Config = Config
272273 , confReadNTimeout :: Bool
273274 }
274275
276+ -- | Default config. This is just a template to modify via
277+ -- field names. Don't use this without modifications.
278+ defaultConfig :: Config
279+ defaultConfig =
280+ Config
281+ { confWriteBuffer = nullPtr
282+ , confBufferSize = 0
283+ , confSendAll = \ _ -> return ()
284+ , confReadN = \ _ -> return " "
285+ , confPositionReadMaker = defaultPositionReadMaker
286+ , confTimeoutManager = T. defaultManager
287+ , confMySockAddr = SockAddrInet 0 0
288+ , confPeerSockAddr = SockAddrInet 0 0
289+ , confReadNTimeout = False
290+ }
291+
275292isAsyncException :: Exception e => e -> Bool
276293isAsyncException e =
277294 case E. fromException (E. toException e) of
Original file line number Diff line number Diff line change @@ -51,7 +51,17 @@ module Network.HTTP2.Server (
5151 rstRateLimit ,
5252
5353 -- * Common configuration
54- Config (.. ),
54+ Config ,
55+ defaultConfig ,
56+ confWriteBuffer ,
57+ confBufferSize ,
58+ confSendAll ,
59+ confReadN ,
60+ confPositionReadMaker ,
61+ confTimeoutManager ,
62+ confMySockAddr ,
63+ confPeerSockAddr ,
64+ confReadNTimeout ,
5565 allocSimpleConfig ,
5666 allocSimpleConfig' ,
5767 freeSimpleConfig ,
Original file line number Diff line number Diff line change 11module Network.HTTP2.Server.Internal (
22 Request (.. ),
33 Response (.. ),
4+ Config (.. ),
5+ ServerConfig (.. ),
46 Aux (.. ),
57
68 -- * Low level
You can’t perform that action at this time.
0 commit comments