ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::ClientSessionSettings Class Reference

Settings for an Poco::Net::HTTPClientSession. More...

#include <ClientSessionSettings.h>

Public Member Functions

 ClientSessionSettings ()
 Create a default ClientSessionSettings.
 
virtual ~ClientSessionSettings ()
 Destroy the ClientSessionSettings.
 
void setUserAgent (const std::string &userAgent)
 Set the user-agent for this client session. More...
 
std::string getUserAgent () const
 
void setMaxRedirects (std::size_t maxRedirects)
 Set the max number of redirects to automatically follow. More...
 
std::size_t getMaxRedirects () const
 
const Poco::Net::NameValueCollection & getDefaultHeaders () const
 Get the default headers to included with each request. More...
 
void setDefaultHeaders (const Poco::Net::NameValueCollection &headers)
 Set the default headers to included with each request. headers The default headers to included with each request.
 
void addDefaultHeader (const std::string &name, const std::string &value)
 Add a default headers to included with each request. name The header name. value The header value.
 
void setkeepAlive (bool keepAlive)
 Enable or disable the session keep-alive. More...
 
bool getKeepAlive () const
 
void setKeepAliveTimeout (Poco::Timespan keepAliveTimeout)
 Set the keep-alive timeout. More...
 
Poco::Timespan getKeepAliveTimeout () const
 
void setTimeout (Poco::Timespan timeout)
 Set the client timeout. More...
 
Poco::Timespan getTimeout () const
 
void setProxy (const ProxySettings &proxy)
 Set the proxy settings for this client session. More...
 
const ProxySettingsgetProxySettings () const
 
void setMinimumBytesPerProgressUpdate (int64_t minimumBytesPerProgressUpdate)
 Set the minimum number of bytes per progress update. More...
 
int64_t getMinimumBytesPerProgressUpdate () const
 
void setMaximumProgressUpdateInterval (Poco::Timespan interval)
 Set the maximum interval between progress updates. More...
 
Poco::Timespan getMaximumProgressUpdateInterval () const
 

Static Public Attributes

static const std::string DEFAULT_USER_AGENT = "Mozilla/5.0 (compatible; Client/1.0 +https://github.com/bakercp/ofxHTTP)"
 The default user agent sent with the client.
 
static const std::size_t DEFAULT_MAX_REDIRECTS = 20
 The default max number of redirects to automatically follow.
 
static const Poco::Timespan DEFAULT_KEEPALIVE_TIMEOUT = Poco::Timespan::SECONDS * 8
 The default keep alive timeout.
 
static const Poco::Timespan DEFAULT_TIMEOUT = Poco::Timespan::SECONDS * 60
 The default client timeout.
 
static const int64_t DEFAULT_MINIMUM_BYTES_PER_PROGRESS_UPDATE = 1024
 The default number of bytes to wait between progress update events.
 
static const Poco::Timespan DEFAULT_MAXIMUM_PROGRESS_UPDATE_INTERVAL = Poco::Timespan::SECONDS * 1
 The default maximum interval between progress updates.
 

Detailed Description

Settings for an Poco::Net::HTTPClientSession.

This is used by a Context to configure client / server interaction.

Member Function Documentation

◆ getDefaultHeaders()

const Poco::Net::NameValueCollection & ofx::HTTP::ClientSessionSettings::getDefaultHeaders ( ) const

Get the default headers to included with each request.

Returns
the default headers to included with each request.

◆ getKeepAlive()

bool ofx::HTTP::ClientSessionSettings::getKeepAlive ( ) const
Returns
True if keep-alive is enabled.

◆ getKeepAliveTimeout()

Poco::Timespan ofx::HTTP::ClientSessionSettings::getKeepAliveTimeout ( ) const
Returns
The keep-alive timeout.

◆ getMaximumProgressUpdateInterval()

Poco::Timespan ofx::HTTP::ClientSessionSettings::getMaximumProgressUpdateInterval ( ) const
Returns
the maximum interval between progress updates.

◆ getMaxRedirects()

std::size_t ofx::HTTP::ClientSessionSettings::getMaxRedirects ( ) const
Returns
The max number of redirects to automatically follow.

◆ getMinimumBytesPerProgressUpdate()

int64_t ofx::HTTP::ClientSessionSettings::getMinimumBytesPerProgressUpdate ( ) const
Returns
The minimum number of bytes per progress update.

◆ getProxySettings()

const ProxySettings & ofx::HTTP::ClientSessionSettings::getProxySettings ( ) const
Returns
the current proxy settings.

◆ getTimeout()

Poco::Timespan ofx::HTTP::ClientSessionSettings::getTimeout ( ) const
Returns
The client timeout.

◆ getUserAgent()

std::string ofx::HTTP::ClientSessionSettings::getUserAgent ( ) const
Returns
the current user-agent.

◆ setkeepAlive()

void ofx::HTTP::ClientSessionSettings::setkeepAlive ( bool  keepAlive)

Enable or disable the session keep-alive.

Parameters
keepAliveTrue if keep-alive should be enabled.

◆ setKeepAliveTimeout()

void ofx::HTTP::ClientSessionSettings::setKeepAliveTimeout ( Poco::Timespan  keepAliveTimeout)

Set the keep-alive timeout.

Parameters
keepAliveTimeoutThe keep-alive timeout.

◆ setMaximumProgressUpdateInterval()

void ofx::HTTP::ClientSessionSettings::setMaximumProgressUpdateInterval ( Poco::Timespan  interval)

Set the maximum interval between progress updates.

This is useful for slow connections to keep the update data rate up-to-date.

A value of 0 will effectively disable the maximum interval.

Parameters
intervalThe interval to set.

◆ setMaxRedirects()

void ofx::HTTP::ClientSessionSettings::setMaxRedirects ( std::size_t  maxRedirects)

Set the max number of redirects to automatically follow.

Parameters
maxRedirectsThe max number of redirects to automatically follow.

◆ setMinimumBytesPerProgressUpdate()

void ofx::HTTP::ClientSessionSettings::setMinimumBytesPerProgressUpdate ( int64_t  minimumBytesPerProgressUpdate)

Set the minimum number of bytes per progress update.

This is the default number of bytes to wait between progress update events events. If this number is very low, then too many events may be sent. If this number is too high, the progress updates may not come frequently enough to be useful.

A value of 0 will disable the progress updates.

Parameters
bytesPerProgressUpdateThe number of bytes to set.

◆ setProxy()

void ofx::HTTP::ClientSessionSettings::setProxy ( const ProxySettings proxy)

Set the proxy settings for this client session.

Parameters
proxyThe proxy settings to use.

◆ setTimeout()

void ofx::HTTP::ClientSessionSettings::setTimeout ( Poco::Timespan  timeout)

Set the client timeout.

Parameters
clientTimeoutThe client timeout to set.

◆ setUserAgent()

void ofx::HTTP::ClientSessionSettings::setUserAgent ( const std::string &  userAgent)

Set the user-agent for this client session.

Parameters
userAgentThe user agent string.

The documentation for this class was generated from the following files: