changeset 37825:e82b137a8b4e stable

hgweb: guard against empty Content-Length header Discussion in issue 5860 seems to indicate this can occur. Differential Revision: https://phab.mercurial-scm.org/D3432
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 27 Apr 2018 14:51:02 -0700
parents 2968ad548583
children d105bbb74658
files mercurial/hgweb/request.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/request.py	Thu Apr 26 21:10:56 2018 +0900
+++ b/mercurial/hgweb/request.py	Fri Apr 27 14:51:02 2018 -0700
@@ -313,7 +313,8 @@
     if bodyfh is None:
         bodyfh = env['wsgi.input']
         if 'Content-Length' in headers:
-            bodyfh = util.cappedreader(bodyfh, int(headers['Content-Length']))
+            bodyfh = util.cappedreader(bodyfh,
+                                       int(headers['Content-Length'] or '0'))
 
     return parsedrequest(method=env['REQUEST_METHOD'],
                          url=fullurl, baseurl=baseurl,