##// END OF EJS Templates
hgweb: fix decodevaluefromheaders to always return a bytes value...
Augie Fackler -
r34745:0a2ef612 default
parent child Browse files
Show More
@@ -30,15 +30,18 b" HGTYPE2 = 'application/mercurial-0.2'"
30 30 HGERRTYPE = 'application/hg-error'
31 31
32 32 def decodevaluefromheaders(req, headerprefix):
33 """Decode a long value from multiple HTTP request headers."""
33 """Decode a long value from multiple HTTP request headers.
34
35 Returns the value as a bytes, not a str.
36 """
34 37 chunks = []
35 38 i = 1
39 prefix = headerprefix.upper().replace(r'-', r'_')
36 40 while True:
37 v = req.env.get('HTTP_%s_%d' % (
38 headerprefix.upper().replace('-', '_'), i))
41 v = req.env.get(r'HTTP_%s_%d' % (prefix, i))
39 42 if v is None:
40 43 break
41 chunks.append(v)
44 chunks.append(pycompat.bytesurl(v))
42 45 i += 1
43 46
44 47 return ''.join(chunks)
General Comments 0
You need to be logged in to leave comments. Login now