Google APIs Client Library for C++
|
Configures options on an HttpTransport instanceEach HttpTransport instance maintains its own options however typically the default options are set on the HttpTransportFactory so that the options will apply to all transport instances. More...
#include "client/transport/http_transport.h"
Public Member Functions | |
HttpTransportOptions () | |
Standard constructor. | |
virtual | ~HttpTransportOptions () |
Standard destructor. | |
void | set_executor (thread::Executor *executor) |
Set the executor to use for asynchronous requests. | |
thread::Executor * | executor () const |
Returns the executor that should be used with this transport. | |
const HttpTransportErrorHandler * | error_handler () const |
Returns the error handler for this transport. | |
void | set_error_handler (const HttpTransportErrorHandler *error_handler) |
Replaces the error handler to use on this transport. | |
const string & | user_agent () const |
Returns the value used for the HTTP User-Agent header. | |
void | SetApplicationName (const StringPiece &name) |
Refines the user agent to use the given application name. | |
void | set_nonstandard_user_agent (const string &agent) |
Sets an exact literal value to use for the HTTP User-Agent header. | |
bool | ssl_verification_disabled () const |
Returns true if SSL verification has been disabled. | |
const string & | cacerts_path () const |
Returns the path to the SSL certificate authority validation data. | |
void | set_cacerts_path (const StringPiece &path) |
Sets the path to the SSL certificate authority validation data. | |
Static Public Member Functions | |
static string | DetermineDefaultApplicationName () |
Returns the default application name assumed for this process. | |
static string | DetermineDefaultCaCertsPath () |
Returns the default location of the SSL certificate validation data. | |
Static Public Attributes | |
static const StringPiece | kGoogleApisUserAgent |
An identifier used to declare this client library within the User-Agent. | |
static const StringPiece | kDisableSslVerification |
A magical cacerts_path value indicating we intend on disabling the ca certificate validation. |
Configures options on an HttpTransport instance
Each HttpTransport instance maintains its own options however typically the default options are set on the HttpTransportFactory so that the options will apply to all transport instances.
Sometimes you may in fact want to configure an an individual instance in some special way.
Options are simple data objects so support assignment and the copy constructor.
Standard constructor.
The options will be constructed without an error handler or executor. It will use the default cacerts_path for SSL verification the default application name in the user agent.
virtual ~HttpTransportOptions | ( | ) | [virtual] |
Standard destructor.
const string& cacerts_path | ( | ) | const [inline] |
Returns the path to the SSL certificate authority validation data.
static string DetermineDefaultApplicationName | ( | ) | [static] |
Returns the default application name assumed for this process.
The default name will be the filename of the program that is curently running (without other path elements).
static string DetermineDefaultCaCertsPath | ( | ) | [static] |
Returns the default location of the SSL certificate validation data.
The default location is assumed to be the same directory as the executable for the running process in a file called 'roots.pem'.
const HttpTransportErrorHandler* error_handler | ( | ) | const [inline] |
Returns the error handler for this transport.
The default options have the standard built-in error handler pre-assigned.
thread::Executor* executor | ( | ) | const |
Returns the executor that should be used with this transport.
void set_cacerts_path | ( | const StringPiece & | path | ) |
Sets the path to the SSL certificate authority validation data.
void set_error_handler | ( | const HttpTransportErrorHandler * | error_handler | ) | [inline] |
Replaces the error handler to use on this transport.
[in] | error_handler/ | NULL indicates do not perform any error handling. Caller retains ownership. |
void set_executor | ( | thread::Executor * | executor | ) | [inline] |
Set the executor to use for asynchronous requests.
Setting the executor to NULL will use the global default executor.
[in] | executor | The executor this transport will use. The caller retains ownership so should guarantee that the executor will remain valid over the lifetime of these options and any options assigned from it. |
void set_nonstandard_user_agent | ( | const string & | agent | ) |
Sets an exact literal value to use for the HTTP User-Agent header.
You may use this, but we would prefer you use SetApplicationName instead, especially if talking to servers hosted on the Google Cloud Platform.
void SetApplicationName | ( | const StringPiece & | name | ) |
Refines the user agent to use the given application name.
[in] | name | The application name to use within the User-Agent header. |
bool ssl_verification_disabled | ( | ) | const [inline] |
Returns true if SSL verification has been disabled.
To disable SSL verification you must explicitly set the cacerts_path to kDisableSslVerification.
const string& user_agent | ( | ) | const [inline] |
Returns the value used for the HTTP User-Agent header.
We recommend using SetApplicationName to change the application name if the default is not appropriate. Use set_nonstandard_user_agent to change the default to an arbitrary literal value if you must.
const StringPiece kDisableSslVerification [static] |
A magical cacerts_path value indicating we intend on disabling the ca certificate validation.
const StringPiece kGoogleApisUserAgent [static] |
An identifier used to declare this client library within the User-Agent.