]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: override the numeric locale and set "C" by force
authorDaniel Stenberg <daniel@haxx.se>
Wed, 23 Nov 2022 10:24:26 +0000 (11:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 25 Nov 2022 07:32:23 +0000 (08:32 +0100)
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

docs/cmdline-opts/connect-timeout.d
docs/cmdline-opts/expect100-timeout.d
docs/cmdline-opts/max-time.d
src/tool_operate.c

index 6a2889d2168423d307c642a37fd69335f7a57167..002e96a064a9f67a8c6824f99883f940546d9836 100644 (file)
@@ -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.
index 93e3c633e1d484d2ccb0252ea27cb61d0024adb8..279b90b29f570f4523e42dd6fe851ff315c04a8f 100644 (file)
@@ -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.
index 8efef1279679a97113735d8676a5c2c06ca7a5a4..e50fb53bc3fd99fadcd70177a0db3d18ab4ee88e 100644 (file)
@@ -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.
index cd137ec10dc11772df737593d735ae85f2f99a96..7af73a266c1e49cc4098c9ab4167fcba9b50f94e 100644 (file)
@@ -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 */