aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-11-04 12:56:30 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-11-04 20:56:26 +0100
commitee8016b3de0b0e3e9a352a1123c5e6272848aa55 (patch)
tree65362606421074a0e5fc9582175afba34e47e5a6 /src
parent90abb74ff0e3134d8647722cee36b1815c14143d (diff)
curl: speed up handling of many URLs
By properly keeping track of the last entry in the list of URLs/uploads to handle, curl now avoids many meaningless traverses of the list which speeds up many-URL handling *MASSIVELY* (several magnitudes on 100K URLs). Added test 1291, to verify that it doesn't take ages - but we don't have any detection of "too slow" command in the test suite. Reported-by: arainchik on github Fixes #1959 Closes #2052
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c20
2 files changed, 11 insertions, 10 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index 23943fe7b..ddfc9bfce 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -114,6 +114,7 @@ struct OperationConfig {
struct getout *url_last; /* point to the last/current node */
struct getout *url_get; /* point to the node to fill in URL */
struct getout *url_out; /* point to the node to fill in outfile */
+ struct getout *url_ul; /* point to the node to fill in upload */
char *cipher_list;
char *proxy_cipher_list;
char *cert;
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index b65c45732..12e3abd55 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -787,7 +787,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
url = config->url_get;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_get = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;
@@ -1787,7 +1787,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
url = config->url_out;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_out = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;
@@ -1912,23 +1912,23 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
/* we are uploading */
{
struct getout *url;
- if(!config->url_out)
- config->url_out = config->url_list;
- if(config->url_out) {
+ if(!config->url_ul)
+ config->url_ul = config->url_list;
+ if(config->url_ul) {
/* there's a node here, if it already is filled-in continue to find
an "empty" node */
- while(config->url_out && (config->url_out->flags & GETOUT_UPLOAD))
- config->url_out = config->url_out->next;
+ while(config->url_ul && (config->url_ul->flags & GETOUT_UPLOAD))
+ config->url_ul = config->url_ul->next;
}
/* now there might or might not be an available node to fill in! */
- if(config->url_out)
+ if(config->url_ul)
/* existing node */
- url = config->url_out;
+ url = config->url_ul;
else
/* there was no free node, create one! */
- url = new_getout(config);
+ config->url_ul = url = new_getout(config);
if(!url)
return PARAM_NO_MEM;