[PATCH] D111252: [llvm] [Support] [Debuginfo] Add http and debuginfod client libraries and llvm-debuginfod-find tool

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 18 23:11:21 PDT 2021


phosek added a comment.

In D111252#3071626 <https://reviews.llvm.org/D111252#3071626>, @noajshu wrote:

> Gracefully fall back to std::vector buffer if Content-Length is not specified in HTTP response.
> Note that this is ~24x slower for a 3GB download. libCURL executes the callback once per 1KB on average.
> Also moved static callback functions and OffsetBuffer inside an anonymous namespace in HTTPClient.cpp.

Given that `Content-Length` is really required for efficient reads, I think we should consider it mandatory and treat its absence as a protocol error rather than providing an inefficient fallback.

This is what `clangd` does as well, see https://github.com/llvm/llvm-project/blob/8189c4eee74959882f4f31c6c5f969cec5cca7eb/clang-tools-extra/clangd/JSONTransport.cpp#L242. You could also use that implementation as an inspiration for how to parse the header using LLVM libraries and avoid regular expressions.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111252/new/

https://reviews.llvm.org/D111252



More information about the llvm-commits mailing list