changeset 32451:9c3bffcc2fb9 stable

webread: Apply timeout also for initial connection (bug #64826). * liboctave/util/url-transfer.cc (curl_transfer::set_weboptions): Set timeout in Milliseconds for transfer and connection with CURLOPT_TIMEOUT_MS and CURLOPT_CONNECTTIMEOUT_MS. * scripts/web/webread.m: Fix function name in error message. Use transpose operator instead of complex conjugate transpose operator.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 28 Oct 2023 11:57:59 +0200
parents bd42126c2553
children 943a95892df0 c8b6830cde6f
files liboctave/util/url-transfer.cc scripts/web/webread.m
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/url-transfer.cc	Thu Oct 26 10:37:58 2023 -0400
+++ b/liboctave/util/url-transfer.cc	Sat Oct 28 11:57:59 2023 +0200
@@ -753,7 +753,8 @@
 
     set_header_fields (options.HeaderFields);
 
-    SETOPT (CURLOPT_TIMEOUT, options.Timeout);
+    SETOPT (CURLOPT_TIMEOUT_MS, options.Timeout);
+    SETOPT (CURLOPT_CONNECTTIMEOUT_MS, options.Timeout);
 
     if (! options.UserAgent.empty ())
       SETOPT (CURLOPT_USERAGENT, options.UserAgent.c_str ());
--- a/scripts/web/webread.m	Thu Oct 26 10:37:58 2023 -0400
+++ b/scripts/web/webread.m	Sat Oct 28 11:57:59 2023 +0200
@@ -86,14 +86,14 @@
 
   ## Flatten the cell array because the internal processing takes place on
   ## a flattened array.
-  options.HeaderFields = options.HeaderFields(:)';
+  options.HeaderFields = options.HeaderFields(:).';
 
   nargs = 1 + numel (varargin);
   if (nargs == 1)
     response = __restful_service__ (url, cell (), options);
   elseif (rem (nargs, 2) == 1)
     if (! iscellstr (varargin))
-      error ("webwrite: KEYS and VALUES must be strings");
+      error ("webread: KEYS and VALUES must be strings");
     else
       response = __restful_service__ (url, varargin, options);
     endif