[llvm] [Debuginfod] Accept compressed encodings in client (PR #68055)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 17:02:03 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

<details>
<summary>Changes</summary>

All encodings that the underlying libcurl supports are automatically detected and accepted. libcurl will then decompress on the fly. This improves effective network transfer rate and prevents server-side decompression for files stored compressed.

Fixes #<!-- -->63534

---
Full diff: https://github.com/llvm/llvm-project/pull/68055.diff


2 Files Affected:

- (modified) llvm/lib/Debuginfod/HTTPClient.cpp (+2) 
- (modified) llvm/test/tools/llvm-debuginfod-find/headers.test (+2) 


``````````diff
diff --git a/llvm/lib/Debuginfod/HTTPClient.cpp b/llvm/lib/Debuginfod/HTTPClient.cpp
index f9201e4f96268c1..4cca250746a597c 100644
--- a/llvm/lib/Debuginfod/HTTPClient.cpp
+++ b/llvm/lib/Debuginfod/HTTPClient.cpp
@@ -97,6 +97,8 @@ HTTPClient::HTTPClient() {
   assert(Curl && "Curl could not be initialized");
   // Set the callback hooks.
   curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, curlWriteFunction);
+  // Detect supported compressed encodings and accept all.
+  curl_easy_setopt(Curl, CURLOPT_ACCEPT_ENCODING, "");
 }
 
 HTTPClient::~HTTPClient() { curl_easy_cleanup(Curl); }
diff --git a/llvm/test/tools/llvm-debuginfod-find/headers.test b/llvm/test/tools/llvm-debuginfod-find/headers.test
index c838d9fe7dc62de..86517f8fc5a1218 100644
--- a/llvm/test/tools/llvm-debuginfod-find/headers.test
+++ b/llvm/test/tools/llvm-debuginfod-find/headers.test
@@ -16,9 +16,11 @@ RUN: env DEBUGINFOD_CACHE=%t/debuginfod-cache DEBUGINFOD_HEADERS_FILE=%S/Inputs/
 RUN:   | FileCheck --check-prefix ERR -DHEADER_FILE=%S/Inputs/headers %s
 
 NO-HEADERS: Accept: */*
+NO-HEADERS-NEXT: Accept-Encoding: {{.*}}
 NO-HEADERS-NOT: {{.}}
 
 HEADERS:      Accept: */*
+HEADERS-NEXT: Accept-Encoding: {{.*}}
 HEADERS-NEXT: A: B
 HEADERS-NEXT: C: D
 HEADERS-NEXT: E: F

``````````

</details>


https://github.com/llvm/llvm-project/pull/68055


More information about the llvm-commits mailing list