Google APIs Client Library for C++
|
Abstract interface defining an HTTP transport will be specialized for different concrete mechanisms for interacting with HTTP servers. More...
#include "client/transport/http_transport.h"
Public Member Functions | |
HttpTransport (const HttpTransportOptions &options) | |
Construct the transport using the provided options. | |
virtual | ~HttpTransport () |
Starndard destructor. | |
const string & | user_agent () const |
Returns the value of the User-Agent header for this transport instance. | |
const HttpTransportOptions & | options () const |
Retrieve the transport options for this instance. | |
HttpTransportOptions * | mutable_options () |
Get the options to modify this instance. | |
const HttpRequestOptions & | default_request_options () const |
Returns the default options used to initialize new HttpRequest instances. | |
HttpRequestOptions * | mutable_default_request_options () |
Returns modifiable options used to initialize new HttpRequest instances. | |
void | set_id (const StringPiece &id) |
The transport id is used to tag instances for debug/tracing purposes. | |
const string & | id () const |
Returns the instance id for debug/tracing purposes. | |
void | set_scribe (HttpScribe *scribe) |
Sets (or clears) the request scribe. | |
HttpScribe * | scribe () const |
Returns the bound scribe, if any. | |
virtual HttpRequest * | NewHttpRequest (const HttpRequest::HttpMethod &method)=0 |
Create a new HttpRequest instance that will use this transport. |
Abstract interface defining an HTTP transport will be specialized for different concrete mechanisms for interacting with HTTP servers.
This is an abstract interface that acts as the base class for all Http Transports used by the Google APIs for C++ runtime library.
It is recommended that you always use this class when defining classes and interfaces rather than the concrete subclasses. It is recommended that you create instances using factory -- either HttpTransportFactory or HttpTransportLayerConfig::NewDefaultTransport()
on an HttpTransportLayerConfig
instance.
An HttpTransport instance is stateless. It can accomodate multiple outstanding requests to different servers at the same time. There is no technical reason to have multiple instances other than wanting different configurations, such as standard request options.
You must set the HttpTransportOptions::set_cacerts_path() with the path to a file to validate SSL certificates. The SDK provides a "roots.pem" which can validate all the certificates used by Google Cloud Platform servers and other commonly used certificates. To disable SSL verification you can set it to HttpTransportOptions::kDisableSslValidation, though doing so will lose security against some forms of SSL attacks.
HttpTransport | ( | const HttpTransportOptions & | options | ) | [explicit] |
Construct the transport using the provided options.
[in] | options | The options to configure the transport with. |
The options will be copied into a local attribute managed by this instance. To make changes once this instance has been constructed use mutable_transport_options().
virtual ~HttpTransport | ( | ) | [virtual] |
Starndard destructor.
const HttpRequestOptions& default_request_options | ( | ) | const [inline] |
Returns the default options used to initialize new HttpRequest instances.
const string& id | ( | ) | const [inline] |
Returns the instance id for debug/tracing purposes.
HttpRequestOptions* mutable_default_request_options | ( | ) | [inline] |
Returns modifiable options used to initialize new HttpRequest instances.
Changing the options will affect new requests created but will not affect any existing requests.
HttpTransportOptions* mutable_options | ( | ) | [inline] |
Get the options to modify this instance.
Changing the result options will affect the configuration of this instance but might not have effect on existing requests.
virtual HttpRequest* NewHttpRequest | ( | const HttpRequest::HttpMethod & | method | ) | [pure virtual] |
Create a new HttpRequest instance that will use this transport.
This method is the HttpRequest factory. It is the preferred (and often only) way to instantiate a request.
Implemented in JsonPlaybackTransport, and CurlHttpTransport.
const HttpTransportOptions& options | ( | ) | const [inline] |
Retrieve the transport options for this instance.
HttpScribe* scribe | ( | ) | const [inline] |
Returns the bound scribe, if any.
void set_id | ( | const StringPiece & | id | ) | [inline] |
The transport id is used to tag instances for debug/tracing purposes.
The default convention is to use simply the type of transport (ie 'curl').
void set_scribe | ( | HttpScribe * | scribe | ) | [inline] |
Sets (or clears) the request scribe.
Scribes incur significant overhead so are not indended for production use. They are for debugging, testing, and diagnostics.
[in] | scribe | The caller maintains ownership. NULL clears the scribe. |
const string& user_agent | ( | ) | const [inline] |
Returns the value of the User-Agent header for this transport instance.
To change the value, modify the options.