aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/Debuginfod
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-07-04 19:20:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-08 19:02:26 +0000
commit81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch)
tree311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/llvm/include/llvm/Debuginfod
parent5fff09660e06a66bed6482da9c70df328e16bbb6 (diff)
parent145449b1e420787bb99721a429341fa6be3adfb6 (diff)
downloadsrc-81ad626541db97eb356e2c1d4a20eb2a26a766ab.tar.gz
src-81ad626541db97eb356e2c1d4a20eb2a26a766ab.zip
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/Debuginfod')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/Debuginfod/HTTPClient.h44
1 files changed, 4 insertions, 40 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/Debuginfod/HTTPClient.h b/contrib/llvm-project/llvm/include/llvm/Debuginfod/HTTPClient.h
index ca3b76ca9f3f..6c94961032e7 100644
--- a/contrib/llvm-project/llvm/include/llvm/Debuginfod/HTTPClient.h
+++ b/contrib/llvm-project/llvm/include/llvm/Debuginfod/HTTPClient.h
@@ -7,9 +7,8 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// This file contains the declarations of the HTTPClient, HTTPMethod,
-/// HTTPResponseHandler, and BufferedHTTPResponseHandler classes, as well as
-/// the HTTPResponseBuffer and HTTPRequest structs.
+/// This file contains the declarations of the HTTPClient library for issuing
+/// HTTP requests and handling the responses.
///
//===----------------------------------------------------------------------===//
@@ -40,43 +39,13 @@ bool operator==(const HTTPRequest &A, const HTTPRequest &B);
/// of its methods.
class HTTPResponseHandler {
public:
- /// Processes one line of HTTP response headers.
- virtual Error handleHeaderLine(StringRef HeaderLine) = 0;
-
/// Processes an additional chunk of bytes of the HTTP response body.
virtual Error handleBodyChunk(StringRef BodyChunk) = 0;
- /// Processes the HTTP response status code.
- virtual Error handleStatusCode(unsigned Code) = 0;
-
protected:
~HTTPResponseHandler();
};
-/// An HTTP response status code bundled with a buffer to store the body.
-struct HTTPResponseBuffer {
- unsigned Code = 0;
- std::unique_ptr<WritableMemoryBuffer> Body;
-};
-
-/// A simple handler which writes returned data to an HTTPResponseBuffer.
-/// Ignores all headers except the Content-Length, which it uses to
-/// allocate an appropriately-sized Body buffer.
-class BufferedHTTPResponseHandler final : public HTTPResponseHandler {
- size_t Offset = 0;
-
-public:
- /// Stores the data received from the HTTP server.
- HTTPResponseBuffer ResponseBuffer;
-
- /// These callbacks store the body and status code in an HTTPResponseBuffer
- /// allocated based on Content-Length. The Content-Length header must be
- /// handled by handleHeaderLine before any calls to handleBodyChunk.
- Error handleHeaderLine(StringRef HeaderLine) override;
- Error handleBodyChunk(StringRef BodyChunk) override;
- Error handleStatusCode(unsigned Code) override;
-};
-
/// A reusable client that can perform HTTPRequests through a network socket.
class HTTPClient {
#ifdef LLVM_ENABLE_CURL
@@ -107,13 +76,8 @@ public:
/// Handler method.
Error perform(const HTTPRequest &Request, HTTPResponseHandler &Handler);
- /// Performs the Request with the default BufferedHTTPResponseHandler, and
- /// returns its HTTPResponseBuffer or an Error.
- Expected<HTTPResponseBuffer> perform(const HTTPRequest &Request);
-
- /// Performs an HTTPRequest with the default configuration to make a GET
- /// request to the given Url. Returns an HTTPResponseBuffer or an Error.
- Expected<HTTPResponseBuffer> get(StringRef Url);
+ /// Returns the last received response code or zero if none.
+ unsigned responseCode();
};
} // end namespace llvm