softprops / hyperlocal

🔌 ✨rustlang hyper bindings for local unix domain sockets
MIT License
227 stars 46 forks source link

http paths errors #48

Closed beckend closed 3 years ago

beckend commented 3 years ago

I am using it to query podman unix socket and it requires paths such as http://d/v3.0.0/libpod/pods/json, which works fine in curl. But of course such a path is invalid for hyper:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidUri(InvalidAuthority)'
kornelski commented 3 years ago

Hyperlocal supports only local filesystem paths. You need to extract filesystem path out of the pseudo-HTTP URL yourself.

beckend commented 3 years ago

ok thanks

softprops commented 3 years ago

The use case is interesting though. in your example, http://d/v3.0.0/libpod/pods/json how does the client/server know what path to bind to?

kornelski commented 3 years ago

In curl you specify --unix-socket path as a separate argument.

kornelski commented 3 years ago

In superagent I've used to support http+unix://<urlencoded-local-path>/<http-abspath>, http+unix://%2Fabsolute%2Fpath%2Fto%2Funix.sock/request/path

beckend commented 3 years ago

Well I am saying it's a pattern that deserves to be supported.

beckend commented 3 years ago

https://docs.podman.io/en/latest/_static/api.html#operation/PodCreateLibpod

kornelski commented 3 years ago

But curl --unix-socket /run/podman/podman.sock http://d/v3.0.0/libpod/info is not a URL. Note that --unix-socket is one argument, the URL is another. To connect, it's necessary to have both.