Closed cyal1 closed 8 months ago
Do you have an example π ? I want to be sure itβs not something that will be easier to use raw sockets
On Tue, 18 Oct 2022 at 3:47 cyal1 @.***> wrote:
Hello, How can I read a non-standard response
β Reply to this email directly, view it on GitHub https://github.com/realgam3/requests-raw/issues/5, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKOSGGQDUPDRHJ4YSZKTWTWDXXT5ANCNFSM6AAAAAARHSPOB4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I got the same problem, i want to get raw response but an exception throwed
I got the same problem, i want to get raw response but an exception throwed
Can you add the request and the exception + stacktrace so I can find a solution for it?
run this command to fake a response:
echo 'HTTP/1.1 1x OK
Server: xxx
Content-Length: 6
011110' | nc -l 123
Code
import requests_raw
if __name__ == '__main__':
x = requests_raw.raw("http://127.0.0.1:123", "GET / HTTP/1.1\r\n\r\n")
Exception:
('Connection aborted.', BadStatusLine('HTTP/1.1 1x OK\n'))
Traceback:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 308, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: HTTP/1.1 1x OK
Oh so this is actually an issue with httplib but I think o can fix it π 1x is the actual response code? Or 100/101?
On Tue, 10 Jan 2023 at 15:30 Dem0ns @.***> wrote:
run this command to fake a response:
echo 'HTTP/1.1 1x OK Server: xxx Content-Length: 6
011110' | nc -l 123
Code
import requests_raw
if name == 'main': x = requests_raw.raw("http://127.0.0.1:123", "GET / HTTP/1.1\r\n\r\n")
Exception: ('Connection aborted.', BadStatusLine('HTTP/1.1 1x OK\n'))
Traceback:
Traceback (most recent call last): File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "
", line 3, in raise_from File "/opt/homebrew/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File @./3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File @./3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File @.***/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 308, in _read_status raise BadStatusLine(line) http.client.BadStatusLine: HTTP/1.1 1x OK β Reply to this email directly, view it on GitHub https://github.com/realgam3/requests-raw/issues/5#issuecomment-1377278371, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKOSGBRCX7N2L3OPATGG4DWRVP5ZANCNFSM6AAAAAARHSPOB4 . You are receiving this because you commented.Message ID: @.***>
Please try: https://github.com/realgam3/requests-raw/tree/v1.1 :)
Version 2.0.0 Released: https://github.com/realgam3/requests-raw/releases/tag/v2.0.0
Hello, How can I read a non-standard response