Real sendall for HTTPS requests not working
See original GitHub issueI 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:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.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 realsendall
and do the job for you every time there is a connection which you don’t want to mock. Since I am wrapping thesocket
module (and itsssl
counterpart), only the calls you explicitly define anEntry
for should run on the fakesocket
, 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