[PATCH] D112751: [llvm] [Support] Add HTTP Client Support library.

Noah Shutty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 31 23:18:55 PDT 2021


noajshu added a comment.

@labath thank you for your comments on the previous version of this diff before splitting!
I have refactored and simplified things, so that we have three main classes:

- HTTPClient
- HTTPRequest
- HTTPResponseHandler

This diff just adds the skeleton, while the next in the sequence (D112753 <https://reviews.llvm.org/D112753>) adds the CURL client itself. Do you think the base HTTPClient should just use curl by default? In that case perhaps these diffs could be merged.

By the way, I wanted to share some of the motivation for the added complexity of these three classes instead of just an `httpGet` function.
I am thinking ahead to their use in the debuginfod client and server. The HTTPClient and HTTPResponseHandler can be extended for concurrent requests or streaming response handlers, which both could be used for debuginfod.
The client could use concurrent requests to send a HEAD to all N known server URLs at once, rather than serially requesting the asset from each server. Large debugging assets could be processed piece-by-piece using a StreamingHTTPResponseHandler. This would be used during federation by a debuginfod server, enabling immediate write of data chunks received from the peer server back to the client.
Curl’s docs say <https://curl.se/libcurl/c/curl_easy_cleanup.html> that re-use of handles is key to good performance and this is part of the reason to have a Client that reuses a handle when running multiple requests. However I haven't measured this performance difference myself.


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

https://reviews.llvm.org/D112751



More information about the llvm-commits mailing list