equal
deleted
inserted
replaced
28 HGTYPE = 'application/mercurial-0.1' |
28 HGTYPE = 'application/mercurial-0.1' |
29 HGTYPE2 = 'application/mercurial-0.2' |
29 HGTYPE2 = 'application/mercurial-0.2' |
30 HGERRTYPE = 'application/hg-error' |
30 HGERRTYPE = 'application/hg-error' |
31 |
31 |
32 def decodevaluefromheaders(req, headerprefix): |
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 chunks = [] |
37 chunks = [] |
35 i = 1 |
38 i = 1 |
|
39 prefix = headerprefix.upper().replace(r'-', r'_') |
36 while True: |
40 while True: |
37 v = req.env.get('HTTP_%s_%d' % ( |
41 v = req.env.get(r'HTTP_%s_%d' % (prefix, i)) |
38 headerprefix.upper().replace('-', '_'), i)) |
|
39 if v is None: |
42 if v is None: |
40 break |
43 break |
41 chunks.append(v) |
44 chunks.append(pycompat.bytesurl(v)) |
42 i += 1 |
45 i += 1 |
43 |
46 |
44 return ''.join(chunks) |
47 return ''.join(chunks) |
45 |
48 |
46 class webproto(wireproto.abstractserverproto): |
49 class webproto(wireproto.abstractserverproto): |