Closed vetal4444 closed 7 years ago
I don't know how to reproduce this. If you can give me a code snippet that reproduces the issue, then I'll consider reopening the issue.
Thanks!
test_socket
).
In [1]: import requests_unixsocket In [2]: session = requests_unixsocket.Session() In [3]: resp = session.get("@test_socket")
MissingSchema: Invalid URL '@test_socket': No schema supplied. Perhaps you meant http://@test_socket?
Ah ok. I wasn't familiar with abstract namespace sockets. Going to reopen so I can investigate this.
Do you have a particular program (Python or otherwise) that creates an abstract namespace socket that you're trying to communicate with?
I wonder if you tried replacing @
with \0
? It seems that's the way to reference abstract domain sockets in C and Python.
You might want to try:
resp = session.get("http+unix://\0test_socket")
Looks like the URL parsing fails:
$ python --version
Python 3.6.9
$ pip show requests-unixsocket | grep Version
Version: 0.1.5
$ python -c "from requests_unixsocket import Session; Session().get('http+unix://\0test_socket')"
Traceback (most recent call last):
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/models.py", line 379, in prepare_url
scheme, auth, host, port, path, query, fragment = parse_url(url)
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/urllib3/util/url.py", line 234, in parse_url
raise LocationParseError(url)
urllib3.exceptions.LocationParseError: Failed to parse: http+unix://test_socket
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/sessions.py", line 519, in request
prep = self.prepare_request(req)
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/sessions.py", line 462, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/models.py", line 313, in prepare
self.prepare_url(url, params)
File "/home/hoefling/projects/.venvs/bjoern-py36/lib/python3.6/site-packages/requests/models.py", line 381, in prepare_url
raise InvalidURL(*e.args)
requests.exceptions.InvalidURL: Failed to parse: http+unix://test_socket
While curl
requests the endpoint just fine:
$ curl --abstract-unix-socket test_socket -i http://127.0.0.1/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 yo
Connection: Keep-Alive
Transfer-Encoding: chunked
Add support for abstruct namespace unix socket. Currently it is raised
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
.