Google APIs Client Library for C++
HttpTransportOptions Class Reference

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"

List of all members.

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::Executorexecutor () const
 Returns the executor that should be used with this transport.
const HttpTransportErrorHandlererror_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.

Detailed Description

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.

See also:
HttpTransport
HttpTransportFactory::mutable_default_transport_options()

Constructor & Destructor Documentation

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.

See also:
DetermineDefaultApplicationName
DetermineDefaultCaCertsPath
virtual ~HttpTransportOptions ( ) [virtual]

Standard destructor.


Member Function Documentation

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.

Returns:
NULL if no error handler has been set.

Returns the executor that should be used with this transport.

Returns:
If the transport is using the global default hten the global default will be returned. This might still be NULL if no global default was set.
void set_cacerts_path ( const StringPiece &  path)

Sets the path to the SSL certificate authority validation data.

See also:
DetermineDefaultCaCertsPath
void set_error_handler ( const HttpTransportErrorHandler error_handler) [inline]

Replaces the error handler to use on this transport.

Parameters:
[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.

Parameters:
[in]executorThe 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.

See also:
SetApplicationName
void SetApplicationName ( const StringPiece &  name)

Refines the user agent to use the given application name.

Parameters:
[in]nameThe application name to use within the User-Agent header.
See also:
DetermineDefaultApplicationName
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.


Member Data Documentation

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines