Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/request.py @ 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 | 877185de62cf |
children | 3e3acf5d6a07 |
comparison
equal
deleted
inserted
replaced
37824:2968ad548583 | 37825:e82b137a8b4e |
---|---|
311 headers['Content-Type'] = env['CONTENT_TYPE'] | 311 headers['Content-Type'] = env['CONTENT_TYPE'] |
312 | 312 |
313 if bodyfh is None: | 313 if bodyfh is None: |
314 bodyfh = env['wsgi.input'] | 314 bodyfh = env['wsgi.input'] |
315 if 'Content-Length' in headers: | 315 if 'Content-Length' in headers: |
316 bodyfh = util.cappedreader(bodyfh, int(headers['Content-Length'])) | 316 bodyfh = util.cappedreader(bodyfh, |
317 int(headers['Content-Length'] or '0')) | |
317 | 318 |
318 return parsedrequest(method=env['REQUEST_METHOD'], | 319 return parsedrequest(method=env['REQUEST_METHOD'], |
319 url=fullurl, baseurl=baseurl, | 320 url=fullurl, baseurl=baseurl, |
320 advertisedurl=advertisedfullurl, | 321 advertisedurl=advertisedfullurl, |
321 advertisedbaseurl=advertisedbaseurl, | 322 advertisedbaseurl=advertisedbaseurl, |