Signed-off-by: Alice Zhang <alizh...@redhat.com>
---
 debuginfod/debuginfod-client.c | 17 ++++++++---------
 tests/run-debuginfod-find.sh   |  6 ++++++
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index c2aa4e10..3764b5f2 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -722,7 +722,6 @@ debuginfod_query_server (debuginfod_client *c,
       else
         snprintf(data[i].url, PATH_MAX, "%s%s/%s/%s", server_url,
                  slashbuildid, build_id_bytes, type);
-
       curl_easy_setopt(data[i].handle, CURLOPT_URL, data[i].url);
       curl_easy_setopt(data[i].handle,
                        CURLOPT_WRITEFUNCTION,
@@ -867,29 +866,29 @@ debuginfod_query_server (debuginfod_client *c,
 
               if (msg->easy_handle != NULL)
                 {
-                  char *effective_url = NULL;
                   long resp_code = 500;
+                 char *scheme = NULL;
                   CURLcode ok1 = curl_easy_getinfo (target_handle,
-                                                   CURLINFO_EFFECTIVE_URL,
-                                                   &effective_url);
-                  CURLcode ok2 = curl_easy_getinfo (target_handle,
                                                    CURLINFO_RESPONSE_CODE,
                                                    &resp_code);
-                  if(ok1 == CURLE_OK && ok2 == CURLE_OK && effective_url)
+                 CURLcode ok2 = curl_easy_getinfo (target_handle,
+                                                    CURLINFO_SCHEME,
+                                                    &scheme);
+                  if(ok1 == CURLE_OK && ok2 == CURLE_OK && scheme)
                     {
-                      if (strncmp (effective_url, "http", 4) == 0)
+                     if (strncmp (scheme, "HTTP", 4) == 0)
                         if (resp_code == 200)
                           {
                             verified_handle = msg->easy_handle;
                             break;
                           }
-                      if (strncmp (effective_url, "file", 4) == 0)
+                     if (strncmp (scheme, "FILE", 4) == 0)
                         if (resp_code == 0)
                           {
                             verified_handle = msg->easy_handle;
                             break;
                           }
-                    }
+                   }
                 }
             }
         }
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index f0c77c51..730bb0e1 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -413,6 +413,12 @@ testrun ${abs_top_builddir}/debuginfod/debuginfod-find 
debuginfo $BUILDID && fal
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
 testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
+# test again with scheme free url
+export DEBUGINFOD_URLS=127.0.0.1:$PORT1
+rm -rf $DEBUGINFOD_CACHE_PATH
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID && 
false || true
+export DEBUGINFOD_URLS=127.0.0.1:$PORT2
+testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUILDID
 
 # test parallel queries in client
 export DEBUGINFOD_CACHE_PATH=${PWD}/.client_cache3
-- 
2.25.4

Reply via email to