Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadStatusLine: HTTP/1.1 0 in urlopen #41

Open
vnmabus opened this issue Nov 3, 2023 · 1 comment
Open

BadStatusLine: HTTP/1.1 0 in urlopen #41

vnmabus opened this issue Nov 3, 2023 · 1 comment

Comments

@vnmabus
Copy link

vnmabus commented Nov 3, 2023

When executing urlopen (after patching) in a JupyterLite kernel, I get the following error.

---------------------------------------------------------------------------
BadStatusLine                             Traceback (most recent call last)
Cell In[5], line 1
----> 1 with urlopen(pkg_url) as package:
      2     with tarfile.open(fileobj=package, mode="r|gz") as package_tar:
      3         for member in package_tar:

File /lib/python3.11/site-packages/pyodide_http/_urllib.py:53, in urlopen(url, *args, **kwargs)
     41 response_data = (
     42     b"HTTP/1.1 "
     43     + str(resp.status_code).encode("ascii")
   (...)
     49     + resp.body
     50 )
     52 response = HTTPResponse(FakeSock(response_data))
---> 53 response.begin()
     54 return response

File /lib/python311.zip/http/client.py:318, in HTTPResponse.begin(self)
    316 # read until we get a non-100 response
    317 while True:
--> 318     version, status, reason = self._read_status()
    319     if status != CONTINUE:
    320         break

File /lib/python311.zip/http/client.py:306, in HTTPResponse._read_status(self)
    304     status = int(status)
    305     if status < 100 or status > 999:
--> 306         raise BadStatusLine(line)
    307 except ValueError:
    308     raise BadStatusLine(line)

BadStatusLine: HTTP/1.1 0
@koenvo
Copy link
Owner

koenvo commented Nov 16, 2023

This is probably related to #26

The status 0 response (HTTP/1.1 0) often indicates the request failed. Could you check the network tab?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants