HTTPTransport executes a HTTP request using the specified URL, HTTP method, headers, and body. This class can only issue a synchronous HTTP request.
More...
#include "util/net/http_transport.h"
|
void | SetURL (const std::string &url) |
| Sets URL to which the request will be made. More...
|
|
void | SetMethod (const std::string &http_method) |
| Sets the HTTP method to execute. E.g., GET, POST, etc. The default method is "POST" . More...
|
|
void | SetHeader (const std::string &header, const std::string &value) |
| Sets a HTTP header-value pair. More...
|
|
void | SetBodyStream (std::unique_ptr< HTTPBodyStream > stream) |
| Sets the stream object from which to generate the HTTP body. More...
|
|
void | SetTimeout (double timeout) |
| Sets the timeout for the HTTP request. The default is 15 seconds. More...
|
|
void | SetRootCACertificatePath (const base::FilePath &cert) |
| Sets a certificate file to be used in lieu of the system CA cert bundle. More...
|
|
virtual bool | ExecuteSynchronously (std::string *response_body)=0 |
| Performs the HTTP request with the configured parameters and waits for the execution to complete. More...
|
|
|
const std::string & | url () const |
|
const std::string & | method () const |
|
const HTTPHeaders & | headers () const |
|
HTTPBodyStream * | body_stream () const |
|
double | timeout () const |
|
const base::FilePath & | root_ca_certificate_path () const |
|
HTTPTransport executes a HTTP request using the specified URL, HTTP method, headers, and body. This class can only issue a synchronous HTTP request.
This class cannot be instantiated directly. A concrete subclass must be instantiated instead, which provides an implementation to execute the request that is appropriate for the host operating system.
◆ Create()
std::unique_ptr< HTTPTransport > crashpad::HTTPTransport::Create |
( |
| ) |
|
|
static |
◆ ExecuteSynchronously()
virtual bool crashpad::HTTPTransport::ExecuteSynchronously |
( |
std::string * |
response_body | ) |
|
|
pure virtual |
Performs the HTTP request with the configured parameters and waits for the execution to complete.
- Parameters
-
[out] | response_body | On success, this will be set to the HTTP response body. This parameter is optional and may be set to nullptr if the response body is not required. |
- Returns
- Whether or not the request was successful, defined as returning a HTTP status code in the range 200-203 (inclusive).
◆ SetBodyStream()
void crashpad::HTTPTransport::SetBodyStream |
( |
std::unique_ptr< HTTPBodyStream > |
stream | ) |
|
Sets the stream object from which to generate the HTTP body.
- Parameters
-
◆ SetHeader()
void crashpad::HTTPTransport::SetHeader |
( |
const std::string & |
header, |
|
|
const std::string & |
value |
|
) |
| |
Sets a HTTP header-value pair.
- Parameters
-
[in] | header | The HTTP header name. Any previous value set at this name will be overwritten. |
[in] | value | The value to set for the header. |
◆ SetMethod()
void crashpad::HTTPTransport::SetMethod |
( |
const std::string & |
http_method | ) |
|
Sets the HTTP method to execute. E.g., GET, POST, etc. The default method is "POST"
.
- Parameters
-
[in] | http_method | The HTTP method. |
◆ SetRootCACertificatePath()
void crashpad::HTTPTransport::SetRootCACertificatePath |
( |
const base::FilePath & |
cert | ) |
|
Sets a certificate file to be used in lieu of the system CA cert bundle.
This is exposed primarily for testing with a self-signed certificate, and it isn't necessary to set it in normal use.
- Parameters
-
[in] | cert | The filename of a file in PEM format containing the CA cert to be used for TLS connections. |
◆ SetTimeout()
void crashpad::HTTPTransport::SetTimeout |
( |
double |
timeout | ) |
|
Sets the timeout for the HTTP request. The default is 15 seconds.
- Parameters
-
[in] | timeout | The request timeout, in seconds. |
◆ SetURL()
void crashpad::HTTPTransport::SetURL |
( |
const std::string & |
url | ) |
|
Sets URL to which the request will be made.
- Parameters
-
The documentation for this class was generated from the following files:
- util/net/http_transport.h
- util/net/http_transport.cc
- util/net/http_transport_socket.cc
- util/net/http_transport_win.cc