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.
( )
durin42 |
hg-reviewers |
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.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/hgweb/request.py (3 lines) | |||
M | mercurial/wireprotoserver.py (4 lines) |
keep_blank_values=1)) | keep_blank_values=1)) | ||||
self._start_response = start_response | self._start_response = start_response | ||||
self.server_write = None | self.server_write = None | ||||
self.headers = [] | self.headers = [] | ||||
def __iter__(self): | def __iter__(self): | ||||
return iter([]) | return iter([]) | ||||
def read(self, count=-1): | |||||
return self.inp.read(count) | |||||
def drain(self): | def drain(self): | ||||
'''need to read all data from request, httplib is half-duplex''' | '''need to read all data from request, httplib is half-duplex''' | ||||
length = int(self.env.get('CONTENT_LENGTH') or 0) | length = int(self.env.get('CONTENT_LENGTH') or 0) | ||||
for s in util.filechunkiter(self.inp, limit=length): | for s in util.filechunkiter(self.inp, limit=length): | ||||
pass | pass | ||||
def respond(self, status, type, filename=None, body=None): | def respond(self, status, type, filename=None, body=None): | ||||
if not isinstance(type, str): | if not isinstance(type, str): |
data[k] = knownargs[k][0] | data[k] = knownargs[k][0] | ||||
return [data[k] for k in keys] | return [data[k] for k in keys] | ||||
def _args(self): | def _args(self): | ||||
args = util.rapply(pycompat.bytesurl, self._wsgireq.form.copy()) | args = util.rapply(pycompat.bytesurl, self._wsgireq.form.copy()) | ||||
postlen = int(self._req.headers.get(b'X-HgArgs-Post', 0)) | postlen = int(self._req.headers.get(b'X-HgArgs-Post', 0)) | ||||
if postlen: | if postlen: | ||||
args.update(urlreq.parseqs( | args.update(urlreq.parseqs( | ||||
self._wsgireq.read(postlen), keep_blank_values=True)) | self._wsgireq.inp.read(postlen), keep_blank_values=True)) | ||||
return args | return args | ||||
argvalue = decodevaluefromheaders(self._req, b'X-HgArg') | argvalue = decodevaluefromheaders(self._req, b'X-HgArg') | ||||
args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) | args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) | ||||
return args | return args | ||||
def forwardpayload(self, fp): | def forwardpayload(self, fp): | ||||
# Existing clients *always* send Content-Length. | # Existing clients *always* send Content-Length. | ||||
length = int(self._req.headers[b'Content-Length']) | length = int(self._req.headers[b'Content-Length']) | ||||
# If httppostargs is used, we need to read Content-Length | # If httppostargs is used, we need to read Content-Length | ||||
# minus the amount that was consumed by args. | # minus the amount that was consumed by args. | ||||
length -= int(self._req.headers.get(b'X-HgArgs-Post', 0)) | length -= int(self._req.headers.get(b'X-HgArgs-Post', 0)) | ||||
for s in util.filechunkiter(self._wsgireq, limit=length): | for s in util.filechunkiter(self._wsgireq.inp, limit=length): | ||||
fp.write(s) | fp.write(s) | ||||
@contextlib.contextmanager | @contextlib.contextmanager | ||||
def mayberedirectstdio(self): | def mayberedirectstdio(self): | ||||
oldout = self._ui.fout | oldout = self._ui.fout | ||||
olderr = self._ui.ferr | olderr = self._ui.ferr | ||||
out = util.stringio() | out = util.stringio() |