Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look into supporting nicer URL syntax of curl-unix-socket #8

Open
msabramo opened this issue Mar 23, 2015 · 7 comments
Open

Look into supporting nicer URL syntax of curl-unix-socket #8

msabramo opened this issue Mar 23, 2015 · 7 comments

Comments

@msabramo
Copy link
Collaborator

Inspired by issue #7, as I think the current syntax is ugly and too error-prone.

root@db2722aaf51d:/# curl-unix-socket unix:///var/run/docker.sock:/info
{"Containers":2,"Debug":1,"DockerRootDir":"/var/lib/docker","Driver":"btrfs","DriverStatus":[],"ExecutionDriver":"native-0.2","ID":"EXI6:MA6J:YU45:24S3:CA6L:37PQ:JLKG:WPWI:5NFP:L3XW:WECP:HWK3","IPv4Forwarding":1,"Images":86,"IndexServerAddress":"https://index.docker.io/v1/","InitPath":"/usr/bin/docker","InitSha1":"","KernelVersion":"4.0.0-rc3","Labels":null,"MemTotal":33343193088,"MemoryLimit":1,"NCPU":8,"NEventsListener":0,"NFd":24,"NGoroutines":53,"Name":"debian","OperatingSystem":"Debian GNU/Linux 8 (jessie)","RegistryConfig":{"IndexConfigs":{"docker.io":{"Mirrors":null,"Name":"docker.io","Official":true,"Secure":true}},"InsecureRegistryCIDRs":["127.0.0.0/8"]},"SwapLimit":1,"SystemTime":"2015-03-18T12:00:18.261465223-07:00"}

Cc: @jakubroztocil, @jfrazelle

@jkbrzt
Copy link
Member

jkbrzt commented Feb 20, 2017

Sounds good, anything needed from HTTTPie?

@msabramo
Copy link
Collaborator Author

msabramo commented Feb 22, 2017

@jkbrzt: Question: Is it possible for an HTTPie transport plugin to support multiple prefixes? E.g.:

class UnixSocketTransportPlugin(TransportPlugin):
    name = 'UNIX socket transport'

    prefix = ['http://sock.local/', 'http+unix://']

    def get_adapter(self):
        return UnixAdapter()

Because I have a new scheme that I'm playing with, but I thought it would be nice to support the old prefix too. Though maybe I shouldn't worry too much about it, since the version number is < 1 and thus arguably, people should be willing to accept breaking changes.

@jkbrzt
Copy link
Member

jkbrzt commented Feb 22, 2017

@msabramo the plugin API currently only supports one prefix per plugin. But you could, for example, expose two plugins (differing only in the prefix) in setup.py, e.g.:

    entry_points={
        'httpie.plugins.transport.v1': [
            'httpie_unixsocket = httpie_unixsocket:UnixSocketTransportPlugin',
            'httpie_unixsocket_legacy = httpie_unixsocket:LegacyUnixSocketTransportPlugin',
        ]
    },

@graingert
Copy link

you can't use sock.local

".local" is the domain used to advertise with multicast DNS.

you need to use a subdomain of your own domain name.

@msabramo
Copy link
Collaborator Author

@jkbrzt: Thanks! Yeah that's what I was starting to think of as well after I posted my comment. Not a bad option. Although I might end up not needing it, because folks seem to be wanting to keep the http+unix:// protocol, in which case I could get by with just one plugin object.

@msabramo
Copy link
Collaborator Author

Note: I have begun working on this in msabramo/requests-unixsocket#34

@msabramo
Copy link
Collaborator Author

Thanks, @graingert! Yeah a few people have mentioned that; I wasn't aware that .local has special meaning; good to know! And I see you found and commented on msabramo/requests-unixsocket#34, which is great, because that's where all that discussion is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants