feature request: support specifying Unix socket with systemd directive OpenFile=
Erik Sjölund via curl-users <[email protected]>
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <CAB+1q0QRp_-hPCbXPROr2Lp7TSLxvLy=uOSJ689oDg+imi7abA@mail.gmail.com> |
Hello, curl already has the command-line option --unix-socket path where the UNIX socket is specified as a path in the file system. It would be nice if curl would also support using an inherited file descriptor that originates from systemd. The systemd directive OpenFile= was introduced in systemd 253 (released February 2023). Man page: https://www.freedesktop.org/software/systemd/man/systemd.service.html#OpenFile= Rationale: Due to restrictive file permissions on a Unix socket, curl might not be able to connect to the Unix socket of a web server. By letting systemd connect to the Unix socket and then letting curl inherit the file descriptor, curl would be able to retrieve web pages from the Unix socket. Demo: I wrote a minimal demo where I modified docs/examples/externalsocket.c to make use of a Unix socket specified with OpenFile= https://github.com/eriksjolund/podman-OpenFile https://github.com/eriksjolund/curl/blob/externalsocket_openfile/docs/examples/externalsocket.c Regarding the user interface, a new command-line argument could be added For example: --unix-socket-fdname myfdname A side note: OpenFile= could also be used for opening normal files. In addition to the already existing command-line argument --proxy-cacert a new command-line argument --proxy-cacert-fdname myfdname could be added. Kind regards, Erik Sjölund -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.html