curl: use CURLINFO_PROTOCOL to check for HTTP(s)

... instead of CURLINFO_EFFECTIVE_URL to avoid string operations.
This commit is contained in:
Daniel Stenberg 2019-08-06 11:49:03 +02:00
parent f933449d3b
commit d39ae9d493
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 3 additions and 4 deletions

View File

@ -453,10 +453,9 @@ static CURLcode post_transfer(struct GlobalConfig *global,
/* If it returned OK. _or_ failonerror was enabled and it
returned due to such an error, check for HTTP transient
errors to retry on. */
char *effective_url = NULL;
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
if(effective_url &&
checkprefix("http", effective_url)) {
long protocol;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
if((protocol == CURLPROTO_HTTP) || (protocol == CURLPROTO_HTTPS)) {
/* This was HTTP(S) */
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);