mercurial/hgweb/request.py
changeset 36847 ed0456fde625
parent 36814 f9078c6caeb6
child 36848 16292bbda39c
--- a/mercurial/hgweb/request.py	Thu Mar 08 16:38:01 2018 -0800
+++ b/mercurial/hgweb/request.py	Sat Mar 10 10:45:12 2018 -0800
@@ -200,6 +200,13 @@
 
     headers = wsgiheaders.Headers(headers)
 
+    # This is kind of a lie because the HTTP header wasn't explicitly
+    # sent. But for all intents and purposes it should be OK to lie about
+    # this, since a consumer will either either value to determine how many
+    # bytes are available to read.
+    if 'CONTENT_LENGTH' in env and 'HTTP_CONTENT_LENGTH' not in env:
+        headers['Content-Length'] = env['CONTENT_LENGTH']
+
     return parsedrequest(url=fullurl, baseurl=baseurl,
                          advertisedurl=advertisedfullurl,
                          advertisedbaseurl=advertisedbaseurl,