diff --git a/src/poetry/inspection/lazy_wheel.py b/src/poetry/inspection/lazy_wheel.py index 885ea7166e5..e807eab5382 100644 --- a/src/poetry/inspection/lazy_wheel.py +++ b/src/poetry/inspection/lazy_wheel.py @@ -611,13 +611,18 @@ def _extract_content_length( resp = e.response code = resp.status_code if resp is not None else None # Our initial request using a negative byte range was not supported. - if code in [codes.not_implemented, codes.method_not_allowed]: + if code in { + codes.method_not_allowed, + codes.internal_server_error, + codes.not_implemented, + }: # pypi notably does not support negative byte ranges: see # https://github.com/pypi/warehouse/issues/12823. logger.debug( "Negative byte range not supported for domain '%s': " - "using HEAD request before lazy wheel from now on", + "using HEAD request before lazy wheel from now on (code: %s)", domain, + code, ) # Avoid trying a negative byte range request against this domain for the # rest of the resolve. diff --git a/tests/inspection/test_lazy_wheel.py b/tests/inspection/test_lazy_wheel.py index b32bdd48d4f..7eea30f33de 100644 --- a/tests/inspection/test_lazy_wheel.py +++ b/tests/inspection/test_lazy_wheel.py @@ -158,6 +158,7 @@ def handle_request( None, (codes.method_not_allowed, b"Method not allowed"), (codes.requested_range_not_satisfiable, b"Requested range not satisfiable"), + (codes.internal_server_error, b"Internal server error"), (codes.not_implemented, b"Unsupported client range"), (NEGATIVE_OFFSET_AS_POSITIVE, b"handle negative offset as positive"), ],