Mercurial > hg
comparison mercurial/wireprotoserver.py @ 36851:d6cd1451212e
hgweb: remove wsgirequest.read()
This was just a proxy to self.inp.read(). This method serves little
value. Let's nuke it.
Callers in the wire protocol server have been updated accordingly.
Differential Revision: https://phab.mercurial-scm.org/D2748
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 08 Mar 2018 17:57:07 -0800 |
parents | 0bc771bba220 |
children | 2cdf47e14c30 |
comparison
equal
deleted
inserted
replaced
36850:e85574176467 | 36851:d6cd1451212e |
---|---|
81 def _args(self): | 81 def _args(self): |
82 args = util.rapply(pycompat.bytesurl, self._wsgireq.form.copy()) | 82 args = util.rapply(pycompat.bytesurl, self._wsgireq.form.copy()) |
83 postlen = int(self._req.headers.get(b'X-HgArgs-Post', 0)) | 83 postlen = int(self._req.headers.get(b'X-HgArgs-Post', 0)) |
84 if postlen: | 84 if postlen: |
85 args.update(urlreq.parseqs( | 85 args.update(urlreq.parseqs( |
86 self._wsgireq.read(postlen), keep_blank_values=True)) | 86 self._wsgireq.inp.read(postlen), keep_blank_values=True)) |
87 return args | 87 return args |
88 | 88 |
89 argvalue = decodevaluefromheaders(self._req, b'X-HgArg') | 89 argvalue = decodevaluefromheaders(self._req, b'X-HgArg') |
90 args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) | 90 args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) |
91 return args | 91 return args |
95 length = int(self._req.headers[b'Content-Length']) | 95 length = int(self._req.headers[b'Content-Length']) |
96 | 96 |
97 # If httppostargs is used, we need to read Content-Length | 97 # If httppostargs is used, we need to read Content-Length |
98 # minus the amount that was consumed by args. | 98 # minus the amount that was consumed by args. |
99 length -= int(self._req.headers.get(b'X-HgArgs-Post', 0)) | 99 length -= int(self._req.headers.get(b'X-HgArgs-Post', 0)) |
100 for s in util.filechunkiter(self._wsgireq, limit=length): | 100 for s in util.filechunkiter(self._wsgireq.inp, limit=length): |
101 fp.write(s) | 101 fp.write(s) |
102 | 102 |
103 @contextlib.contextmanager | 103 @contextlib.contextmanager |
104 def mayberedirectstdio(self): | 104 def mayberedirectstdio(self): |
105 oldout = self._ui.fout | 105 oldout = self._ui.fout |