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

Already on GitHub? Sign in to your account

support http over unix domain sockets #209

Closed
monsanto opened this Issue Apr 4, 2014 · 7 comments

Comments

Projects
None yet
7 participants

monsanto commented Apr 4, 2014

For security reasons, some of my HTTP services need to run on a unix domain socket so I can protect them using filesystem permissions. It would be useful if I could use httpie for testing these services.

docker-py uses the requests library and has support for this--see https://github.com/dotcloud/docker-py/blob/master/docker/unixconn/unixconn.py for the (small) implementation, and https://github.com/dotcloud/docker-py/blob/master/docker/client.py#L90 for how they extend requests using self.mount.

np commented Apr 7, 2014

+1 (for the same reason)

nuxlli commented May 25, 2014

+1

+1 or you can use socat to redirect the unixsocket to tcp socket http://serverfault.com/questions/517906/how-to-expose-a-unix-domain-socket-directly-over-tcp

Contributor

msabramo commented Aug 29, 2014

+1 because one can run gunicorn and make it listen on a unix domain socket and then have nginx proxy to it - it is easier to have these internal servers listen on a named socket than to pick ports for them in an environment with a lot of services. The fact that nginx can proxy to unix domain sockets leads me to believe that a decent number of servers (esp. WSGI and Rack servers) probably support listening on unix domain sockets. Gunicorn is certainly one of these.

I would love a feature
where I can specify the unix domain socket as a command-line option.

remmelt commented Nov 21, 2014

+1 as well. Would be great for Docker API calls.

@msabramo msabramo referenced this issue in requests/requests Nov 25, 2014

Closed

Unix domain sockets #2355

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
d838a91

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
f068583
Contributor

msabramo commented Nov 25, 2014

See PR #276 for a possible solution.

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
de27129

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
fec497a

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
666d7e5

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 25, 2014

@msabramo msabramo Add support for unix domain sockets
adapted from some code from docker-py:

* https://github.com/docker/docker-py/blob/master/docker/unixconn/unixconn.py

Also submitted this UnixAdapter code to requests as
requests/requests#2355

Fixes: GH-209 (jakubroztocil#209)
1b13eb3

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 28, 2014

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
03d809c

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 28, 2014

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
f6e78dc

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 28, 2014

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
f636886

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Nov 28, 2014

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
9d5d55c

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Dec 4, 2014

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
153412c

@msabramo msabramo added a commit to msabramo/httpie that referenced this issue Feb 4, 2015

@msabramo msabramo Add support for unix domain sockets
To issue HTTP requests to a UNIX domain socket:

  * Use new "http+unix://" scheme in URL.
  * Use urlencoded socket path as the hostname part of the URL.
    e.g.: for a socket at /tmp/profilesvc.sock, you could do:

    http http+unix://%2Ftmp%2Fprofilesvc.sock/status/pid

This uses https://pypi.python.org/pypi/requests-unixsocket

Fixes: GH-209 (jakubroztocil#209)
e72b6ab
Owner

jakubroztocil commented Feb 7, 2015

Implemented as a plugin (supported by HTTPie v0.9.1+): httpie-unixsocket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment