[Debuginfod] Don't depend on Content-Length.
authorDaniel Thornburgh <dthorn@google.com>
Fri, 11 Mar 2022 01:51:13 +0000 (01:51 +0000)
committerDaniel Thornburgh <dthorn@google.com>
Mon, 21 Mar 2022 17:27:45 +0000 (17:27 +0000)
commit7917b3c6957cdf9f4cb4f4908971184d7bbe38e7
treeeade8c3effce4baf8ecd1ed0f5790d2daa4205fa
parent8692e27ad671c31514e2ab828974924c149e741b
[Debuginfod] Don't depend on Content-Length.

The present implementation of debuginfod lookups requires the
Content-Length field to be populated in the HTTP server response.
Unfortunately, Content-Length is optional, and there are some real
scenarios where it's missing. (For example, a Google Cloud Storage
server doing on-the-fly gunzipping.)

This changes the debuginfod response handler to directly stream the
output to the cache file as it is received. In addition to allowing
lookups to proceed without a Content-Lenght, it seems somewhat more
straightforward to implement, and it allows the disk I/O to be
interleaved with the network I/O.

Reviewed By: noajshu

Differential Revision: https://reviews.llvm.org/D121720
llvm/include/llvm/Debuginfod/HTTPClient.h
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/Debuginfod/HTTPClient.cpp
llvm/unittests/Debuginfod/CMakeLists.txt
llvm/unittests/Debuginfod/HTTPClientTests.cpp [deleted file]