From 286ddb09f4a4ef6e5a1e9866b13506bde9840b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Sat, 28 Oct 2023 11:57:59 +0200 Subject: [PATCH] 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. --- liboctave/util/url-transfer.cc | 3 ++- scripts/web/webread.m | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/liboctave/util/url-transfer.cc b/liboctave/util/url-transfer.cc index c55d3a6d2c..54deab4169 100644 --- a/liboctave/util/url-transfer.cc +++ b/liboctave/util/url-transfer.cc @@ -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 ()); diff --git a/scripts/web/webread.m b/scripts/web/webread.m index 5492216cab..a1e0caedc7 100644 --- a/scripts/web/webread.m +++ b/scripts/web/webread.m @@ -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