On Friday, 11 August 2017 at 18:39:54 UTC, dvnguyen wrote:
How to make http requests to unix socket? For example, in Docker engine api,


curl --unix-socket /var/run/docker.sock http:/v1.24/containers/json

I made a pull request a year ago or so to have vibe-d's requestHttp to support unix sockets. Call it like this `requestHTTP("https+unix://%2Fvar%2Frun%2Fdocker.sock/containers/create`. You will need to set some vibe-d tls things to accept the connection.

Sönke just upgraded vibe-core/event-core to support it as well if I remember it correctly (so you can also use vibe 8.x with vibe-core).

As for endpoints which return streams (like containers/"~id~"/logs?stdout=1&stderr=1&follow=1), Docker multiplexes stdout/stderr over http with chunked transfer-encoding. The protocol is a 8 byte Header + Frame. The last four bytes in the Header is an uint32 representing the frame size. The first byte is either 1 -> stdout or 2 -> stderr, which designates the type of the stream in the following frame.

Reply via email to