[Bug,debuginfod/31620] debuginfod should not require ssl support from libcurl

Message ID bug-31620-10460-nlEfbMwaOV@http.sourceware.org/bugzilla/
State Committed
Headers
Series [Bug,debuginfod/31620] debuginfod should not require ssl support from libcurl |

Commit Message

dodji at seketeli dot org April 8, 2024, 5:30 p.m. UTC
  https://sourceware.org/bugzilla/show_bug.cgi?id=31620

--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> ---
like this?  can you test?
  

Patch

diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 0ee7db3d6638..a3468f534656 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -1367,14 +1367,19 @@  debuginfod_query_server (debuginfod_client *c,
        }                                               \
       } while (0)

+      curl_version_info_data *d = curl_version_info(CURLVERSION_NOW);
+      
       /* Only allow http:// + https:// + file:// so we aren't being
         redirected to some unsupported protocol.  */
 #if CURL_AT_LEAST_VERSION(7, 85, 0)
       curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS_STR,
-                         "http,https,file");
+                          ((d && d->ssl_version) ?
+                           "http,https,file" : "http,file"));
 #else
       curl_easy_setopt_ck(data[i].handle, CURLOPT_PROTOCOLS,
-                         (CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
+                         (CURLPROTO_HTTP |
+                           ((d && d->ssl_version) ? CURLPROTO_HTTPS : 0) |
+                           CURLPROTO_FILE));
 #endif
       curl_easy_setopt_ck(data[i].handle, CURLOPT_URL, data[i].url);
       if (vfd >= 0)