]> granicus.if.org Git - curl/commitdiff
curl: use CURLINFO_PROTOCOL to check for HTTP(s)
authorDaniel Stenberg <daniel@haxx.se>
Tue, 6 Aug 2019 09:49:03 +0000 (11:49 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 Aug 2019 12:45:39 +0000 (14:45 +0200)
... instead of CURLINFO_EFFECTIVE_URL to avoid string operations.

src/tool_operate.c

index 8d526c328bcca02a2fe25d8b6cc8180d0865f5c9..923b5a99dda9b81a02389a1f1decd7fb6cc22eda 100644 (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);