comparison mercurial/hgweb/protocol.py @ 34743:dc2bf7074147

hgweb: more "headers are native strs" cleanup I'll fix the decodevaluefromheaders function in an upcoming change. Differential Revision: https://phab.mercurial-scm.org/D1111
author Augie Fackler <augie@google.com>
date Sun, 15 Oct 2017 00:42:25 -0400
parents 5a9cad0dfddb
children 0a2ef612ad50
comparison
equal deleted inserted replaced
34742:5a9cad0dfddb 34743:dc2bf7074147
67 def _args(self): 67 def _args(self):
68 args = self.req.form.copy() 68 args = self.req.form.copy()
69 if pycompat.ispy3: 69 if pycompat.ispy3:
70 args = {k.encode('ascii'): [v.encode('ascii') for v in vs] 70 args = {k.encode('ascii'): [v.encode('ascii') for v in vs]
71 for k, vs in args.items()} 71 for k, vs in args.items()}
72 postlen = int(self.req.env.get('HTTP_X_HGARGS_POST', 0)) 72 postlen = int(self.req.env.get(r'HTTP_X_HGARGS_POST', 0))
73 if postlen: 73 if postlen:
74 args.update(cgi.parse_qs( 74 args.update(cgi.parse_qs(
75 self.req.read(postlen), keep_blank_values=True)) 75 self.req.read(postlen), keep_blank_values=True))
76 return args 76 return args
77 77
78 argvalue = decodevaluefromheaders(self.req, 'X-HgArg') 78 argvalue = decodevaluefromheaders(self.req, r'X-HgArg')
79 args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) 79 args.update(cgi.parse_qs(argvalue, keep_blank_values=True))
80 return args 80 return args
81 def getfile(self, fp): 81 def getfile(self, fp):
82 length = int(self.req.env[r'CONTENT_LENGTH']) 82 length = int(self.req.env[r'CONTENT_LENGTH'])
83 # If httppostargs is used, we need to read Content-Length 83 # If httppostargs is used, we need to read Content-Length
113 if not v1compressible: 113 if not v1compressible:
114 return HGTYPE, None, None 114 return HGTYPE, None, None
115 115
116 # Determine the response media type and compression engine based 116 # Determine the response media type and compression engine based
117 # on the request parameters. 117 # on the request parameters.
118 protocaps = decodevaluefromheaders(self.req, 'X-HgProto').split(' ') 118 protocaps = decodevaluefromheaders(self.req, r'X-HgProto').split(' ')
119 119
120 if '0.2' in protocaps: 120 if '0.2' in protocaps:
121 # Default as defined by wire protocol spec. 121 # Default as defined by wire protocol spec.
122 compformats = ['zlib', 'none'] 122 compformats = ['zlib', 'none']
123 for cap in protocaps: 123 for cap in protocaps: