question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Real sendall for HTTPS requests not working

See original GitHub issue

I am using Python 3.6.4 and getting this error when I try to use mocket:

E           http.client.BadStatusLine: 2

/usr/local/Cellar/python3/3.6.4_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py:279: BadStatusLine

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dustinfarriscommented, Jan 4, 2018

Sorry for the vagueness, wrote this in a hurry.

It looks like it happens when a match fails.

For example I have a test where I set match_querystring to False, but if I forget to do that I get this error.

0reactions
mindflayercommented, Nov 21, 2018

Now that I see it, the problem is much more clear and I am already aware about it. It is definitely a problem, because Mocket should call the real sendall and do the job for you every time there is a connection which you don’t want to mock. Since I am wrapping the socket module (and its ssl counterpart), only the calls you explicitly define an Entry for should run on the fake socket, and all the others should simply work on the real one. Basically, SSL sockets are not working like we expect, and I am trying to fix it on this branch: https://github.com/mindflayer/python-mocket/tree/ssl-fix

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python socket server handle HTTPS request - Stack Overflow
Everything works as expected when I issue an HTTP request: the server accepts it and answers correctly.
Read more >
SSLSocket.sendall() does not return None on success like ...
SSLSocket.sendall() is said to have the same behavior as socket.sendall(), besides not allowing flags <https://docs.python.org/3/library/ssl.html#ssl.
Read more >
Making HTTP requests with sockets in Python - Internal Pointers
A practical introduction to network programming, from socket configuration to network buffers and HTTP connection modes.
Read more >
Using Tor to make HTTPS requests in Python
Here are your pyCURL and a howto. UPDATE: Copy-pasting by request - copyright to code to sources mentioned upstrings:
Read more >
Exploring HTTPS With Python - Real Python
In this tutorial, you'll gain a working knowledge of the various factors that combine to keep communications over the Internet safe.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found