Re: How to send requests through UNIX domain socket





On Sat, Aug 20, 2016 at 10:57 AM, Guillaume Poirier-Morency <guillaumepoiriermorency gmail com> wrote:
Not sure for the equivalent in C, but you can pass a custom SoupAddress
to SoupMessage based on a UNIX domain socket:

    var address = new GLib.UnixSocketAddress ("/path/to/socket");
    void* unix_sockaddr;
    size_t unix_sockaddr_len;
    address.to_native (unix_sockaddr, out unix_sockaddr_len);
    var session = new Soup.Session ("local-address", unix_sockaddr);

Did not test it, but it should work.

Le samedi 20 août 2016 à 09:37 +0800, Robin Lee a écrit :
> Hi all,
>
> Any way to send HTTP request through a UNIX domain socket, like
> the CURLOPT_UNIX_SOCKET_PATH(3) option in libcurl>=7.40?
>
> Regards,
> robin
> _______________________________________________
> libsoup-list mailing list
> libsoup-list gnome org
> https://mail.gnome.org/mailman/listinfo/libsoup-list
--
Guillaume Poirier-Morency <guillaumepoiriermorency@gmail.com>

Étudiant au baccalauréat en Informatique à l'Université de Montréal
Chercheur boursier à l'IRIC

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5

_______________________________________________
libsoup-list mailing list
libsoup-list gnome org
https://mail.gnome.org/mailman/listinfo/libsoup-list

The code does not work since UNIX domain socket is not acceptable to build a SoupAddress.

There is an assertion in soup-address.c:
 #define SOUP_ADDRESS_FAMILY_IS_VALID(family) \
        (family == AF_INET || family == AF_INET6)

And "local-address" is not for this usage. The UNIX domain socket should be set as the remote address.

Regards,
robin


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]