@@ -213,8 +213,7 @@ def parse(
213213 read_line : Callable [[int ], Generator [None , None , bytes ]],
214214 read_exact : Callable [[int ], Generator [None , None , bytes ]],
215215 read_to_eof : Callable [[int ], Generator [None , None , bytes ]],
216- include_body : bool = True ,
217- allow_http10 : bool = False ,
216+ proxy : bool = False ,
218217 ) -> Generator [None , None , Response ]:
219218 """
220219 Parse a WebSocket handshake response.
@@ -250,7 +249,7 @@ def parse(
250249 protocol , raw_status_code , raw_reason = status_line .split (b" " , 2 )
251250 except ValueError : # not enough values to unpack (expected 3, got 1-2)
252251 raise ValueError (f"invalid HTTP status line: { d (status_line )} " ) from None
253- if allow_http10 : # some proxies still use HTTP/1.0
252+ if proxy : # some proxies still use HTTP/1.0
254253 if protocol not in [b"HTTP/1.1" , b"HTTP/1.0" ]:
255254 raise ValueError (
256255 f"unsupported protocol; expected HTTP/1.1 or HTTP/1.0: "
@@ -277,12 +276,12 @@ def parse(
277276
278277 headers = yield from parse_headers (read_line )
279278
280- if include_body :
279+ if proxy :
280+ body = b""
281+ else :
281282 body = yield from read_body (
282283 status_code , headers , read_line , read_exact , read_to_eof
283284 )
284- else :
285- body = b""
286285
287286 return cls (status_code , reason , headers , body )
288287
0 commit comments