diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-08-06 11:49:03 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-08-06 22:48:30 +0200 |
commit | 491a4785a2f131331f69d7d1a5c3a4182a719606 (patch) | |
tree | 9cc0639768b2005527ca619431ef3bb27a0485cc | |
parent | 50757569290c409c0df3f6255a9aeb39c16e374e (diff) | |
download | curl-491a4785a2f131331f69d7d1a5c3a4182a719606.tar.gz |
curl: use CURLINFO_PROTOCOL to check for HTTP(s)
... instead of CURLINFO_EFFECTIVE_URL to avoid string operations.
-rw-r--r-- | src/tool_operate.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c index 8d526c328..923b5a99d 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -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); |