http-conduit 1.5.0.2 → 1.5.0.3
raw patch · 3 files changed
+33/−8 lines, 3 files
Files
- Network/HTTP/Conduit.hs +0/−2
- Network/HTTP/Conduit/Request.hs +32/−5
- http-conduit.cabal +1/−1
Network/HTTP/Conduit.hs view
@@ -33,8 +33,6 @@ -- -- * Host ----- * Accept-Encoding (not currently set, but client usage of this variable /will/ cause breakage).--- -- Any network code on Windows requires some initialization, and the network -- library provides withSocketsDo to perform it. Therefore, proper usage of -- this library will always involve calling that function at some point. The
Network/HTTP/Conduit/Request.hs view
@@ -82,6 +82,26 @@ -- ^ Everything from the host to the query string. , queryString :: S.ByteString , requestHeaders :: W.RequestHeaders+ -- ^ Custom HTTP request headers+ --+ -- As already stated in the introduction, the Content-Length and Host+ -- headers are set automatically by this module, and shall not be added to+ -- requestHeaders.+ --+ -- Moreover, the Accept-Encoding header is set implicitly to gzip for+ -- convenience by default. This behaviour can be overridden if needed, by+ -- setting the header explicitly to a different value. In order to omit the+ -- Accept-Header altogether, set it to the empty string \"\". If you need an+ -- empty Accept-Header (i.e. requesting the identity encoding), set it to a+ -- non-empty white-space string, e.g. \" \". See RFC 2616 section 14.3 for+ -- details about the semantics of the Accept-Header field. If you request a+ -- content-encoding not supported by this module, you will have to decode+ -- it yourself (see also the 'decompress' field).+ --+ -- Note: Multiple header fields with the same field-name will result in+ -- multiple header fields being sent and therefore it\'s the responsibility+ -- of the client code to ensure that the rules from RFC 2616 section 4.2+ -- are honoured. , requestBody :: RequestBody m , proxy :: Maybe Proxy -- ^ Optional HTTP proxy.@@ -318,12 +338,19 @@ else (:) ("Content-Length", S8.pack $ show contentLength') contentLengthHeader Nothing = (:) ("Transfer-Encoding", "chunked") + acceptEncodingHeader =+ case lookup "Accept-Encoding" $ requestHeaders req of+ Nothing -> (("Accept-Encoding", "gzip"):)+ Just "" -> filter (\(k, _) -> k /= "Accept-Encoding")+ Just _ -> id++ hostHeader = (("Host", hh):)+ headerPairs :: W.RequestHeaders- headerPairs- = ("Host", hh)- : ("Accept-Encoding", "gzip")- : (contentLengthHeader contentLength)- (requestHeaders req)+ headerPairs = hostHeader+ $ acceptEncodingHeader+ $ contentLengthHeader contentLength+ $ requestHeaders req builder :: Builder builder =
http-conduit.cabal view
@@ -1,5 +1,5 @@ name: http-conduit-version: 1.5.0.2+version: 1.5.0.3 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>