Skip to content

Commit

Permalink
webread: Apply timeout also for initial connection (bug #64826).
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mmuetzel committed Oct 28, 2023
1 parent 1d08a75 commit 286ddb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion liboctave/util/url-transfer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,8 @@ class curl_transfer : public base_url_transfer

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 ());
Expand Down
4 changes: 2 additions & 2 deletions scripts/web/webread.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 286ddb0

Please sign in to comment.