python: Fix pseudo-header field ordering bug

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-31 21:53:13 +09:00
parent 2b6a181bef
commit 1316065c14
1 changed files with 11 additions and 13 deletions

View File

@ -921,8 +921,8 @@ cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
custom_headers = _encode_headers(headers) custom_headers = _encode_headers(headers)
headers = [ headers = [
(b':scheme', scheme.encode('utf-8')),
(b':method', method.encode('utf-8')), (b':method', method.encode('utf-8')),
(b':scheme', scheme.encode('utf-8')),
(b':authority', host.encode('utf-8')), (b':authority', host.encode('utf-8')),
(b':path', path.encode('utf-8')) (b':path', path.encode('utf-8'))
] ]
@ -1161,16 +1161,15 @@ if asyncio:
promised_handler.path = path.encode('utf-8') promised_handler.path = path.encode('utf-8')
promised_handler._set_response_prop(status, headers, body) promised_handler._set_response_prop(status, headers, body)
if request_headers is None: headers = [
request_headers = [] (b':method', promised_handler.method),
(b':scheme', promised_handler.scheme),
(b':authority', promised_handler.host),
(b':path', promised_handler.path)
]
headers.extend(_encode_headers(request_headers))
request_headers = _encode_headers(request_headers) promised_handler.headers = headers
request_headers.append((b':scheme', promised_handler.scheme))
request_headers.append((b':method', promised_handler.method))
request_headers.append((b':authority', promised_handler.host))
request_headers.append((b':path', promised_handler.path))
promised_handler.headers = request_headers
return self.http2.push(self, promised_handler) return self.http2.push(self, promised_handler)
@ -1180,9 +1179,8 @@ if asyncio:
if headers is None: if headers is None:
headers = [] headers = []
self.response_headers = _encode_headers(headers) self.response_headers = [(b':status', str(status).encode('utf-8'))]
self.response_headers.append((b':status', str(status)\ self.response_headers.extend(_encode_headers(headers))
.encode('utf-8')))
self.response_body = body self.response_body = body