|
22 | 22 | from pip._vendor.urllib3.exceptions import ReadTimeoutError, ResponseError |
23 | 23 | from pip._vendor.urllib3.exceptions import SSLError as _SSLError |
24 | 24 | from pip._vendor.urllib3.poolmanager import PoolManager, proxy_from_url |
25 | | -from pip._vendor.urllib3.response import HTTPResponse |
26 | 25 | from pip._vendor.urllib3.util import Timeout as TimeoutSauce |
27 | 26 | from pip._vendor.urllib3.util import parse_url |
28 | 27 | from pip._vendor.urllib3.util.retry import Retry |
@@ -194,7 +193,6 @@ def init_poolmanager( |
194 | 193 | num_pools=connections, |
195 | 194 | maxsize=maxsize, |
196 | 195 | block=block, |
197 | | - strict=True, |
198 | 196 | **pool_kwargs, |
199 | 197 | ) |
200 | 198 |
|
@@ -485,63 +483,19 @@ def send( |
485 | 483 | timeout = TimeoutSauce(connect=timeout, read=timeout) |
486 | 484 |
|
487 | 485 | try: |
488 | | - if not chunked: |
489 | | - resp = conn.urlopen( |
490 | | - method=request.method, |
491 | | - url=url, |
492 | | - body=request.body, |
493 | | - headers=request.headers, |
494 | | - redirect=False, |
495 | | - assert_same_host=False, |
496 | | - preload_content=False, |
497 | | - decode_content=False, |
498 | | - retries=self.max_retries, |
499 | | - timeout=timeout, |
500 | | - ) |
501 | | - |
502 | | - # Send the request. |
503 | | - else: |
504 | | - if hasattr(conn, "proxy_pool"): |
505 | | - conn = conn.proxy_pool |
506 | | - |
507 | | - low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT) |
508 | | - |
509 | | - try: |
510 | | - skip_host = "Host" in request.headers |
511 | | - low_conn.putrequest( |
512 | | - request.method, |
513 | | - url, |
514 | | - skip_accept_encoding=True, |
515 | | - skip_host=skip_host, |
516 | | - ) |
517 | | - |
518 | | - for header, value in request.headers.items(): |
519 | | - low_conn.putheader(header, value) |
520 | | - |
521 | | - low_conn.endheaders() |
522 | | - |
523 | | - for i in request.body: |
524 | | - low_conn.send(hex(len(i))[2:].encode("utf-8")) |
525 | | - low_conn.send(b"\r\n") |
526 | | - low_conn.send(i) |
527 | | - low_conn.send(b"\r\n") |
528 | | - low_conn.send(b"0\r\n\r\n") |
529 | | - |
530 | | - # Receive the response from the server |
531 | | - r = low_conn.getresponse() |
532 | | - |
533 | | - resp = HTTPResponse.from_httplib( |
534 | | - r, |
535 | | - pool=conn, |
536 | | - connection=low_conn, |
537 | | - preload_content=False, |
538 | | - decode_content=False, |
539 | | - ) |
540 | | - except Exception: |
541 | | - # If we hit any problems here, clean up the connection. |
542 | | - # Then, raise so that we can handle the actual exception. |
543 | | - low_conn.close() |
544 | | - raise |
| 486 | + resp = conn.urlopen( |
| 487 | + method=request.method, |
| 488 | + url=url, |
| 489 | + body=request.body, |
| 490 | + headers=request.headers, |
| 491 | + redirect=False, |
| 492 | + assert_same_host=False, |
| 493 | + preload_content=False, |
| 494 | + decode_content=False, |
| 495 | + retries=self.max_retries, |
| 496 | + timeout=timeout, |
| 497 | + chunked=chunked, |
| 498 | + ) |
545 | 499 |
|
546 | 500 | except (ProtocolError, OSError) as err: |
547 | 501 | raise ConnectionError(err, request=request) |
|
0 commit comments