GNOME Bugzilla – Bug 727563
no way to use Unix Domain Sockets (AF_UNIX or AF_LOCAL)
Last modified: 2017-05-01 16:10:12 UTC
Currently there isn't any way to use Unix Domain Sockets with libsoup. There is a patch floating around that allows soup_server to accept an already open socket, I think this is mostly used for systemd, but could help here. But I don't see any way to do this for the client side yet. I believe one of the major blockers on this is what URI to use that would specify a unix domain socket? I don't see anything in the client code that would allow working directly with a socket, everything expects a URI of some sort. And how do we encapsulate a local socket into a URI? Thanks
some additional info in this thread.. https://mail.gnome.org/archives/libsoup-list/2013-January/msg00002.html
continued here https://mail.gnome.org/archives/libsoup-list/2013-February/msg00001.html and here https://mail.gnome.org/archives/libsoup-list/2013-March/msg00000.html
[mass-moving all "UNCONFIRMED" libsoup bugs to "NEW" after disabling the "UNCONFIRMED" status for this product now that bugzilla.gnome.org allows that. bugspam-libsoup-20150210]
This feature would be really useful in snapd-glib [1]. We're currently using hand-written HTTP parsing code and as much of libsoup as we can but would much prefer to use libsoup with a unix socket. I've read the threads and looked at the code and I'm not sure the correct way this should be implemented in libsoup. If someone can give me some pointers I'd be happy to work on a patch. [1] https://launchpad.net/snapd-glib
It would also be nice for communicating with Docker.
(In reply to Robert Ancell from comment #4) > I've read the threads and looked at the code and I'm not sure the correct > way this should be implemented in libsoup. If someone can give me some > pointers I'd be happy to work on a patch. The linked thread was about connecting to a proxy server listening on a UNIX-domain socket and was mostly about trying to get around restrictions in GProxy; talking directly to an HTTP server on a UNIX domain socket would be much simpler. Basically it just comes down to: - Figure out an appropriate way to represent this in a URI (a little bit weird since you have to be able to specify both the path to the socket and the HTTP path to request after connecting to the socket). There might be precedent in other HTTP libraries we could follow. - Add support for connecting to such URIs in SoupSession... I think this would probably involve making SoupConnection into a GTypeInterface and moving the existing code to "SoupConnectionHTTP" and adding a new SoupConnectionUnix with the connecting-to-a-unix-socket code. Or maybe the amount of changed code would be so small that it would make more sense to just put both HTTP and unix into the existing SoupConnection. You'd also have to figure out if it made more sense to extend SoupSocket with unix-domain socket support, or to just bypass SoupSocket in this case and use GSocket directly.