diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-11-23 11:24:26 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-11-25 08:32:23 +0100 |
commit | 975efec61b83b840cf18ab2ee23b9202c60ca8a7 (patch) | |
tree | 1f3c98551f43981daef696301e7f07f1a7b696e5 | |
parent | cde8f284896cea3baa8af2d81a14cb437ffba131 (diff) | |
download | curl-975efec61b83b840cf18ab2ee23b9202c60ca8a7.tar.gz |
tool_operate: override the numeric locale and set "C" by force
Makes curl always use dot as decimal separator for options,
independently of what the locale says. Makes scripts and command lines
portable.
Updated docs accordingly.
Reported-by: Daniel Faust
Fixes #9969
Closes #9972
-rw-r--r-- | docs/cmdline-opts/connect-timeout.d | 3 | ||||
-rw-r--r-- | docs/cmdline-opts/expect100-timeout.d | 3 | ||||
-rw-r--r-- | docs/cmdline-opts/max-time.d | 3 | ||||
-rw-r--r-- | src/tool_operate.c | 3 |
4 files changed, 11 insertions, 1 deletions
diff --git a/docs/cmdline-opts/connect-timeout.d b/docs/cmdline-opts/connect-timeout.d index 6a2889d21..002e96a06 100644 --- a/docs/cmdline-opts/connect-timeout.d +++ b/docs/cmdline-opts/connect-timeout.d @@ -14,3 +14,6 @@ Maximum time in seconds that you allow curl's connection to take. This only limits the connection phase, so if curl connects within the given period it will continue - if not it will exit. Since version 7.32.0, this option accepts decimal values. + +The decimal value needs to provided using a dot (.) as decimal separator - not +the local version even if it might be using another separator. diff --git a/docs/cmdline-opts/expect100-timeout.d b/docs/cmdline-opts/expect100-timeout.d index 93e3c633e..279b90b29 100644 --- a/docs/cmdline-opts/expect100-timeout.d +++ b/docs/cmdline-opts/expect100-timeout.d @@ -14,3 +14,6 @@ Maximum time in seconds that you allow curl to wait for a 100-continue response when curl emits an Expects: 100-continue header in its request. By default curl will wait one second. This option accepts decimal values! When curl stops waiting, it will continue as if the response has been received. + +The decimal value needs to provided using a dot (.) as decimal separator - not +the local version even if it might be using another separator. diff --git a/docs/cmdline-opts/max-time.d b/docs/cmdline-opts/max-time.d index 8efef1279..e50fb53bc 100644 --- a/docs/cmdline-opts/max-time.d +++ b/docs/cmdline-opts/max-time.d @@ -20,3 +20,6 @@ timeout increases in decimal precision. If you enable retrying the transfer (--retry) then the maximum time counter is reset each time the transfer is retried. You can use --retry-max-time to limit the retry time. + +The decimal value needs to provided using a dot (.) as decimal separator - not +the local version even if it might be using another separator. diff --git a/src/tool_operate.c b/src/tool_operate.c index cd137ec10..7af73a266 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -2638,9 +2638,10 @@ CURLcode operate(struct GlobalConfig *global, int argc, argv_item_t argv[]) CURLcode result = CURLE_OK; char *first_arg = argc > 1 ? curlx_convert_tchar_to_UTF8(argv[1]) : NULL; - /* Setup proper locale from environment */ #ifdef HAVE_SETLOCALE + /* Override locale for number parsing (only) */ setlocale(LC_ALL, ""); + setlocale(LC_NUMERIC, "C"); #endif /* Parse .curlrc if necessary */ |