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

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 10:00:34 PDT 2023


Author: Daniel Thornburgh
Date: 2023-10-03T10:00:30-07:00
New Revision: f2357daf12b29aee2ac4903a4431bf9a0dd06328

URL: https://github.com/llvm/llvm-project/commit/f2357daf12b29aee2ac4903a4431bf9a0dd06328
DIFF: https://github.com/llvm/llvm-project/commit/f2357daf12b29aee2ac4903a4431bf9a0dd06328.diff

LOG: [Debuginfod] Accept compressed encodings in client (#68055)

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

Added: 
    

Modified: 
    llvm/lib/Debuginfod/HTTPClient.cpp
    llvm/test/tools/llvm-debuginfod-find/headers.test

Removed: 
    


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


        


More information about the llvm-commits mailing list