Giter Site home page Giter Site logo

Comments (10)

msabramo avatar msabramo commented on May 21, 2024

Interesting. I'll take a look. I also didn't know curl could work with unix sockets so thanks for showing that!

from httpie-unixsocket.

jkbrzt avatar jkbrzt commented on May 21, 2024

@msabramo It's actually curl-unix-socket which is a tool written in Go, not curl. Btw, I wonder if it would be possible to adopt this nicer URL syntax.

from httpie-unixsocket.

jessfraz avatar jessfraz commented on May 21, 2024

cool! thanks for looking into it.

On Thu, Mar 19, 2015 at 5:29 AM, Jakub Roztočil [email protected]
wrote:

@msabramo https://github.com/msabramo It's actually curl-unix-socket
https://github.com/Soulou/curl-unix-socket which is a tool written in
Go, not curl. Btw, I wonder if it would be possible to adopt this nicer
URL syntax.


Reply to this email directly or view it on GitHub
#7 (comment)
.

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

BTW, I created https://github.com/msabramo/requests-unixsocket (which this is based on) with the thought that perhaps https://github.com/docker/docker-py might be able to use it, so if requests-unixsocket won't work with the docker socket, then I'd like to fix it.

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

@jfrazelle: I think this is just a simple typo. You did:

http http+unix://%2Fvar%2Frun%sFdocker.sock/info

And I also got an error when I did that. When I replace the %sF with %2F, it works for me.

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
HTTP/1.1 200 OK
Content-Length: 780
Content-Type: application/json
Date: Mon, 23 Mar 2015 16:21:21 GMT
Job-Name: info

{
    "Containers": 0,
    "Debug": 0,
    "DockerRootDir": "/var/lib/docker",
    "Driver": "aufs",
    "DriverStatus": [
        [
            "Root Dir",
            "/var/lib/docker/aufs"
        ],
        [
            "Backing Filesystem",
            "extfs"
        ],
        [
            "Dirs",
            "0"
        ]
    ],
    "ExecutionDriver": "native-0.2",
    "ID": "TJON:7OGO:YU6Z:LZ7J:VXUY:BHZK:CNI4:BBXR:ZTGC:V7A6:QB3M:L5K3",
    "IPv4Forwarding": 1,
    "Images": 0,
    "IndexServerAddress": "https://index.docker.io/v1/",
    "InitPath": "/usr/bin/docker",
    "InitSha1": "",
    "KernelVersion": "3.13.0-45-generic",
    "Labels": null,
    "MemTotal": 2099113984,
    "MemoryLimit": 1,
    "NCPU": 2,
    "NEventsListener": 0,
    "NFd": 10,
    "NGoroutines": 14,
    "Name": "vagrant-ubuntu-trusty-64",
    "OperatingSystem": "Ubuntu 14.04.1 LTS",
    "RegistryConfig": {
        "IndexConfigs": {
            "docker.io": {
                "Mirrors": null,
                "Name": "docker.io",
                "Official": true,
                "Secure": true
            }
        },
        "InsecureRegistryCIDRs": [
            "127.0.0.0/8"
        ]
    },
    "SwapLimit": 0
}

Does that solve the issue?

This perhaps points out though that perhaps this URL syntax is error-prone and I should look into adopting the nicer URL syntax that curl-unix-socket uses.

from httpie-unixsocket.

jessfraz avatar jessfraz commented on May 21, 2024

Wow so sorry!

On Monday, March 23, 2015, Marc Abramowitz [email protected] wrote:

@jfrazelle https://github.com/jfrazelle: I think this is just a simple
typo. You did:

http http+unix://%2Fvar%2Frun%sFdocker.sock/info

And I also got an error when I did that. When I replace the %sF with %2F,
it works for me.

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://%2Fvar%2Frun%2Fdocker.sock/info
HTTP/1.1 200 OK
Content-Length: 780
Content-Type: application/json
Date: Mon, 23 Mar 2015 16:21:21 GMT
Job-Name: info

{
"Containers": 0,
"Debug": 0,
"DockerRootDir": "/var/lib/docker",
"Driver": "aufs",
"DriverStatus": [
[
"Root Dir",
"/var/lib/docker/aufs"
],
[
"Backing Filesystem",
"extfs"
],
[
"Dirs",
"0"
]
],
"ExecutionDriver": "native-0.2",
"ID": "TJON:7OGO:YU6Z:LZ7J:VXUY:BHZK:CNI4:BBXR:ZTGC:V7A6:QB3M:L5K3",
"IPv4Forwarding": 1,
"Images": 0,
"IndexServerAddress": "https://index.docker.io/v1/",
"InitPath": "/usr/bin/docker",
"InitSha1": "",
"KernelVersion": "3.13.0-45-generic",
"Labels": null,
"MemTotal": 2099113984,
"MemoryLimit": 1,
"NCPU": 2,
"NEventsListener": 0,
"NFd": 10,
"NGoroutines": 14,
"Name": "vagrant-ubuntu-trusty-64",
"OperatingSystem": "Ubuntu 14.04.1 LTS",
"RegistryConfig": {
"IndexConfigs": {
"docker.io": {
"Mirrors": null,
"Name": "docker.io",
"Official": true,
"Secure": true
}
},
"InsecureRegistryCIDRs": [
"127.0.0.0/8"
]
},
"SwapLimit": 0
}

Does that solve the issue?


Reply to this email directly or view it on GitHub
#7 (comment)
.

Jessie Frazelle
4096R / D4C4 DD60 0D66 F65A 8EFC 511E 18F3 685C 0022 BFF3
pgp.mit.edu http://pgp.mit.edu/pks/lookup?op=get&search=0x18F3685C0022BFF3

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

@jakubroztocil: It looks like perhaps httpie needs to be modified a bit to support that nicer syntax?

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix:///var/run/docker.sock:/info

http: error: InvalidURL: Invalid URL u'http+unix:///var/run/docker.sock:/info': No host supplied

It's happier with two slashes instead of three (though it still fails because my library doesn't support the new syntax yet):

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~$ http http+unix://var/run/docker.sock:/info

http: error: ConnectionError: ('Connection aborted.', error(2, 'No such file or directory'))

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

@jfrazelle: No worries. I'm thinking that's a sign that the current syntax is too messy and we should try to have a nicer one like curl-unix-socket does. Interested in helping with that?

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

@jakubroztocil: Re my earlier comment; it seems that it's requests that is emitting the No host supplied error:

❯ ag 'No host supplied' requests
requests/requests/models.py
364:            raise InvalidURL("Invalid URL %r: No host supplied" % url)

but maybe there is something that can be done in httpie to avoid hitting that?

from httpie-unixsocket.

msabramo avatar msabramo commented on May 21, 2024

Here's what the stack trace looks like after I commented out the exception handling in httpie:

(httpie-unixsocket.venv)vagrant@vagrant-ubuntu-trusty-64:~/httpie$ http http+unix:///var/run/docker.sock:/info
Traceback (most recent call last):
  File "/home/vagrant/httpie-unixsocket.venv/bin/http", line 9, in <module>
    load_entry_point('httpie==1.0.0-dev', 'console_scripts', 'http')()
  File "/home/vagrant/httpie/httpie/core.py", line 112, in main
    response = get_response(args, config_dir=env.config.directory)
  File "/home/vagrant/httpie/httpie/client.py", line 41, in get_response
    response = requests_session.request(**kwargs)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 450, in request
    prep = self.prepare_request(req)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/sessions.py", line 381, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/models.py", line 304, in prepare
    self.prepare_url(url, params)
  File "/home/vagrant/httpie-unixsocket.venv/local/lib/python2.7/site-packages/requests/models.py", line 364, in prepare_url
    raise InvalidURL("Invalid URL %r: No host supplied" % url)
requests.exceptions.InvalidURL: Invalid URL u'http+unix:///var/run/docker.sock:/info': No host supplied

from httpie-unixsocket.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.