Bug 727563 - no way to use Unix Domain Sockets (AF_UNIX or AF_LOCAL)
no way to use Unix Domain Sockets (AF_UNIX or AF_LOCAL)
Status: NEW
Product: libsoup
Classification: Core
Component: HTTP Transport
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2014-04-03 19:11 UTC by bill
Modified: 2017-05-01 16:10 UTC (History)
3 users (show)

See Also:
GNOME target: ---
GNOME version: ---


Attachments

Description bill 2014-04-03 19:11:08 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
Comment 1 bill 2014-04-03 19:46:20 UTC
some additional info in this thread..

https://mail.gnome.org/archives/libsoup-list/2013-January/msg00002.html
Comment 3 Dan Winship 2015-02-10 11:58:07 UTC
[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]
Comment 4 Robert Ancell 2016-10-16 13:24:05 UTC
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
Comment 5 Gergely POLONKAI 2017-04-20 08:51:22 UTC
It would also be nice for communicating with Docker.
Comment 6 Dan Winship 2017-05-01 16:10:12 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.