Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Debuginfod] Accept compressed encodings in client #68055

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

mysterymath
Copy link
Contributor

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

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 llvm#63534
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 3, 2023

@llvm/pr-subscribers-debuginfo

Changes

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 --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

@mysterymath mysterymath merged commit f2357da into llvm:main Oct 3, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compressed transfers for debuginfod client
3 participants