Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: feature request: support specifying Unix socket with systemd directive OpenFile=
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Erik Sjölund via curl-users <curl-users_at_lists.haxx.se>
Date: Thu, 22 Jun 2023 09:30:11 +0200
My first idea was to let curl look up the file descriptor number from
the fdname.
Curl could look up the file descriptor number by checking the
colon-separated list of fdnames in the environment variable LISTEN_FDNAMES.
See
https://www.freedesktop.org/software/systemd/man/sd_listen_fds.html
(That man page does not mention that OpenFile= also
uses LISTEN_FDNAMES)
On the other hand, instead of providing an fdname to curl, it would
also be possible to provide the file descriptor number.
So instead of a new option
--unix-socket-fdname myfdname
it could be
--unix-socket-fd 5
or some new syntax, for example
--unix-socket fd://5
or something like that.
If there should be a new syntax, maybe the new syntax should be
enabled by a command-line flag?
This feature flag could be set to false by default. In a few years the
default value could be set to true.
Just so that users are not surprised by the new syntax.
Using an fdname would still be possible by writing a wrapper shell
script that looks up the file descriptor number
from the environment variable LISTEN_FDNAMES and then runs "exec curl ...".
Alternatively, the new syntax could support both file descriptor
numbers and fdnames.
Erik
On Wed, Jun 21, 2023 at 6:48 PM Petr Pisar via curl-users
<curl-users_at_lists.haxx.se> wrote:
>
> V Tue, Jun 20, 2023 at 03:44:10PM -0400, Rich Gray via curl-users napsal(a):
> > Instead of adding a -fd variant to each command, maybe a more generic
> > approach would be to have a syntax that indicates a filename is really an
> > fd. Something like an ampersand followed by the digits of fd number. (An
> > ampersand ('&') would require suitable command line escaping/quoting.) This
> > could be used with any command that recognizes the alternative syntax. A
> > favorite of mine would be -K, --config with an fd to hide command line
> > options when a program is driving curl.
> >
> The syntax could be a URI. E.g. to use a fifth descriptor for reading
> a configuration:
>
> --config fd://5
>
> The only drawback is that it is an ill-formed, yet still accepted file
> system path on many unices. E.g. Linux inteprets it as "./fd:/5". There would
> be a change in behaviour for sloppy users who concatantes paths without
> avoiding double slashes.
>
> On the other hand, one could then write
>
> --config https://my.remote/file
>
> to retrive the configuration with any curl-supported protocol.
>
> -- Petr
>
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
> Etiquette: https://curl.se/mail/etiquette.html
Date: Thu, 22 Jun 2023 09:30:11 +0200
My first idea was to let curl look up the file descriptor number from
the fdname.
Curl could look up the file descriptor number by checking the
colon-separated list of fdnames in the environment variable LISTEN_FDNAMES.
See
https://www.freedesktop.org/software/systemd/man/sd_listen_fds.html
(That man page does not mention that OpenFile= also
uses LISTEN_FDNAMES)
On the other hand, instead of providing an fdname to curl, it would
also be possible to provide the file descriptor number.
So instead of a new option
--unix-socket-fdname myfdname
it could be
--unix-socket-fd 5
or some new syntax, for example
--unix-socket fd://5
or something like that.
If there should be a new syntax, maybe the new syntax should be
enabled by a command-line flag?
This feature flag could be set to false by default. In a few years the
default value could be set to true.
Just so that users are not surprised by the new syntax.
Using an fdname would still be possible by writing a wrapper shell
script that looks up the file descriptor number
from the environment variable LISTEN_FDNAMES and then runs "exec curl ...".
Alternatively, the new syntax could support both file descriptor
numbers and fdnames.
Erik
On Wed, Jun 21, 2023 at 6:48 PM Petr Pisar via curl-users
<curl-users_at_lists.haxx.se> wrote:
>
> V Tue, Jun 20, 2023 at 03:44:10PM -0400, Rich Gray via curl-users napsal(a):
> > Instead of adding a -fd variant to each command, maybe a more generic
> > approach would be to have a syntax that indicates a filename is really an
> > fd. Something like an ampersand followed by the digits of fd number. (An
> > ampersand ('&') would require suitable command line escaping/quoting.) This
> > could be used with any command that recognizes the alternative syntax. A
> > favorite of mine would be -K, --config with an fd to hide command line
> > options when a program is driving curl.
> >
> The syntax could be a URI. E.g. to use a fifth descriptor for reading
> a configuration:
>
> --config fd://5
>
> The only drawback is that it is an ill-formed, yet still accepted file
> system path on many unices. E.g. Linux inteprets it as "./fd:/5". There would
> be a change in behaviour for sloppy users who concatantes paths without
> avoiding double slashes.
>
> On the other hand, one could then write
>
> --config https://my.remote/file
>
> to retrive the configuration with any curl-supported protocol.
>
> -- Petr
>
> --
> Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
> Etiquette: https://curl.se/mail/etiquette.html
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2023-06-22