Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't send Content-Length for GET, HEAD

  • Loading branch information...
commit 9d38027583dbecfc90a4991b5d832cc51a889bc5 1 parent 3fb24dd
@snoyberg authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 Network/HTTP/Enumerator.hs
View
7 Network/HTTP/Enumerator.hs
@@ -240,9 +240,10 @@ http Request {..} bodyStep m = do
| port == 443 && secure = host
| otherwise = host `mappend` S8.pack (':' : show port)
headers' = ("Host", hh)
- : ("Content-Length", S8.pack $ show contentLength)
- : ("Accept-Encoding", "gzip")
- : requestHeaders
+ : (if method `elem` ["GET", "HEAD"] && contentLength == 0
+ then id
+ else (:) ("Content-Length", S8.pack $ show contentLength))
+ (("Accept-Encoding", "gzip") : requestHeaders)
requestHeaders' =
Blaze.fromByteString method
`mappend` Blaze.fromByteString " "
Please sign in to comment.
Something went wrong with that request. Please try again.