Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::Net::HTTPSClientSession Class Reference

#include <HTTPSClientSession.h>

+ Inheritance diagram for Poco::Net::HTTPSClientSession:
+ Collaboration diagram for Poco::Net::HTTPSClientSession:

Public Types

enum  { HTTPS_PORT = 443 }
 
- Public Types inherited from Poco::Net::HTTPClientSession
enum  ProxyAuthentication { PROXY_AUTH_NONE , PROXY_AUTH_HTTP_BASIC , PROXY_AUTH_HTTP_DIGEST , PROXY_AUTH_NTLM }
 
- Public Types inherited from Poco::Net::HTTPSession
enum  { HTTP_PORT = 80 }
 

Public Member Functions

 HTTPSClientSession ()
 
 HTTPSClientSession (const SecureStreamSocket &socket)
 Creates an unconnected HTTPSClientSession.
 
 HTTPSClientSession (const SecureStreamSocket &socket, Session::Ptr pSession)
 
 HTTPSClientSession (const std::string &host, Poco::UInt16 port=HTTPS_PORT)
 
 HTTPSClientSession (Context::Ptr pContext)
 Creates a HTTPSClientSession using the given host and port.
 
 HTTPSClientSession (Context::Ptr pContext, Session::Ptr pSession)
 
 HTTPSClientSession (const std::string &host, Poco::UInt16 port, Context::Ptr pContext)
 
 HTTPSClientSession (const std::string &host, Poco::UInt16 port, Context::Ptr pContext, Session::Ptr pSession)
 
 ~HTTPSClientSession ()
 
bool secure () const
 
X509Certificate serverCertificate ()
 
Session::Ptr sslSession ()
 
void abort ()
 
- Public Member Functions inherited from Poco::Net::HTTPClientSession
 HTTPClientSession ()
 
 HTTPClientSession (const StreamSocket &socket)
 Creates an unconnected HTTPClientSession.
 
 HTTPClientSession (const SocketAddress &address)
 
 HTTPClientSession (const std::string &host, Poco::UInt16 port=HTTPSession::HTTP_PORT)
 Creates a HTTPClientSession using the given address.
 
 HTTPClientSession (const std::string &host, Poco::UInt16 port, const ProxyConfig &proxyConfig)
 Creates a HTTPClientSession using the given host and port.
 
virtual ~HTTPClientSession ()
 Creates a HTTPClientSession using the given host, port and proxy configuration.
 
void setHost (const std::string &host)
 
const std::string & getHost () const
 
void setPort (Poco::UInt16 port)
 Returns the host name of the target HTTP server.
 
Poco::UInt16 getPort () const
 
void setProxy (const std::string &host, Poco::UInt16 port=HTTPSession::HTTP_PORT)
 Returns the port number of the target HTTP server.
 
void setProxyHost (const std::string &host)
 Sets the proxy host name and port number.
 
void setProxyPort (Poco::UInt16 port)
 Sets the host name of the proxy server.
 
const std::string & getProxyHost () const
 Sets the port number of the proxy server.
 
Poco::UInt16 getProxyPort () const
 Returns the proxy host name.
 
void setProxyCredentials (const std::string &username, const std::string &password)
 Returns the proxy port number.
 
void setProxyUsername (const std::string &username)
 
const std::string & getProxyUsername () const
 
void setProxyPassword (const std::string &password)
 Returns the username for proxy authentication.
 
const std::string & getProxyPassword () const
 
void setProxyConfig (const ProxyConfig &config)
 Returns the password for proxy authentication.
 
const ProxyConfiggetProxyConfig () const
 Sets the proxy configuration.
 
void setKeepAliveTimeout (const Poco::Timespan &timeout)
 Returns the global proxy configuration.
 
const Poco::TimespangetKeepAliveTimeout () const
 Sets the connection timeout for HTTP connections.
 
virtual std::ostream & sendRequest (HTTPRequest &request)
 Returns the connection timeout for HTTP connections.
 
virtual std::istream & receiveResponse (HTTPResponse &response)
 
virtual bool peekResponse (HTTPResponse &response)
 
void flushRequest ()
 
void reset ()
 
bool bypassProxy () const
 
- Public Member Functions inherited from Poco::Net::HTTPSession
void setKeepAlive (bool keepAlive)
 
bool getKeepAlive () const
 
void setTimeout (const Poco::Timespan &timeout)
 
void setTimeout (const Poco::Timespan &connectionTimeout, const Poco::Timespan &sendTimeout, const Poco::Timespan &receiveTimeout)
 Sets the timeout for the HTTP session.
 
Poco::Timespan getTimeout () const
 Sets different timeouts for the HTTP session.
 
bool connected () const
 Returns the timeout for the HTTP session.
 
const Poco::ExceptionnetworkException () const
 
void attachSessionData (const Poco::Any &data)
 
const Poco::AnysessionData () const
 
StreamSocket detachSocket ()
 
StreamSocketsocket ()
 
void drainBuffer (Poco::Buffer< char > &buffer)
 Returns a reference to the underlying socket.
 

Protected Member Functions

void connect (const SocketAddress &address)
 Refills the internal buffer.
 
std::string proxyRequestPrefix () const
 Sends the given HTTPRequest over an existing connection.
 
void proxyAuthenticate (HTTPRequest &request)
 Checks if we can reuse a persistent connection.
 
int read (char *buffer, std::streamsize length)
 
- Protected Member Functions inherited from Poco::Net::HTTPClientSession
void reconnect ()
 
int write (const char *buffer, std::streamsize length)
 Connects the underlying socket to the HTTP server.
 
std::ostream & sendRequestImpl (const HTTPRequest &request)
 Tries to re-connect if keep-alive is on.
 
virtual bool mustReconnect () const
 
void proxyAuthenticateImpl (HTTPRequest &request, const ProxyConfig &proxyConfig)
 
void proxyAuthenticateDigest (HTTPRequest &request)
 
void proxyAuthenticateNTLM (HTTPRequest &request)
 Initiates a HTTP Digest authentication handshake with the proxy.
 
void sendChallengeRequest (const HTTPRequest &request, HTTPResponse &response)
 Initiates a HTTP NTLM authentication handshake with the proxy.
 
StreamSocket proxyConnect ()
 
void proxyTunnel ()
 
- Protected Member Functions inherited from Poco::Net::HTTPSession
 HTTPSession ()
 
 HTTPSession (const StreamSocket &socket)
 
 HTTPSession (const StreamSocket &socket, bool keepAlive)
 
virtual ~HTTPSession ()
 
int get ()
 
int peek ()
 
int receive (char *buffer, int length)
 Writes data to the socket.
 
int buffered () const
 Reads up to length bytes.
 
void refill ()
 Returns the number of bytes in the buffer.
 
void attachSocket (const StreamSocket &socket)
 
void close ()
 
void setException (const Poco::Exception &exc)
 Closes the underlying socket.
 
void clearException ()
 Stores a clone of the exception.
 

Private Member Functions

 HTTPSClientSession (const HTTPSClientSession &)
 
HTTPSClientSessionoperator= (const HTTPSClientSession &)
 

Private Attributes

Context::Ptr _pContext
 
Session::Ptr _pSession
 

Additional Inherited Members

- Static Public Member Functions inherited from Poco::Net::HTTPClientSession
static void setGlobalProxyConfig (const ProxyConfig &config)
 Returns the proxy configuration.
 
static const ProxyConfiggetGlobalProxyConfig ()
 
- Protected Types inherited from Poco::Net::HTTPClientSession
enum  { DEFAULT_KEEP_ALIVE_TIMEOUT = 8 }
 

Detailed Description

This class implements the client-side of a HTTPS session.

To send a HTTPS request to a HTTPS server, first instantiate a HTTPSClientSession object and specify the server's host name and port number.

Then create a HTTPRequest object, fill it accordingly, and pass it as argument to the sendRequest() method.

sendRequest() will return an output stream that can be used to send the request body, if there is any.

After you are done sending the request body, create a HTTPResponse object and pass it to receiveResponse().

This will return an input stream that can be used to read the response body.

See RFC 2616 http://www.faqs.org/rfcs/rfc2616.html for more information about the HTTP protocol.

Note that sending requests that neither contain a content length field in the header nor are using chunked transfer encoding will result in a SSL protocol violation, as the framework shuts down the socket after sending the message body. No orderly SSL shutdown will be performed in this case.

If session caching has been enabled for the Context object passed to the HTTPSClientSession, the HTTPSClientSession class will attempt to reuse a previously obtained Session object in case of a reconnect.

Definition at line 38 of file HTTPSClientSession.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
HTTPS_PORT 

Definition at line 73 of file HTTPSClientSession.h.

Constructor & Destructor Documentation

◆ HTTPSClientSession() [1/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( )

◆ HTTPSClientSession() [2/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const SecureStreamSocket & socket)
explicit

Creates an unconnected HTTPSClientSession.

◆ HTTPSClientSession() [3/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const SecureStreamSocket & socket,
Session::Ptr pSession )

Creates a HTTPSClientSession using the given socket. The socket must not be connected. The session takes ownership of the socket.

◆ HTTPSClientSession() [4/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const std::string & host,
Poco::UInt16 port = HTTPS_PORT )

Creates a HTTPSClientSession using the given socket. The socket must not be connected. The session takes ownership of the socket.

The given Session is reused, if possible (client session caching is enabled for the given Context, and the server agrees to reuse the session).

+ Here is the caller graph for this function:

◆ HTTPSClientSession() [5/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( Context::Ptr pContext)
explicit

Creates a HTTPSClientSession using the given host and port.

◆ HTTPSClientSession() [6/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( Context::Ptr pContext,
Session::Ptr pSession )

Creates an unconnected HTTPSClientSession, using the give SSL context.

◆ HTTPSClientSession() [7/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const std::string & host,
Poco::UInt16 port,
Context::Ptr pContext )

Creates an unconnected HTTPSClientSession, using the give SSL context.

The given Session is reused, if possible (client session caching is enabled for the given Context, and the server agrees to reuse the session).

◆ HTTPSClientSession() [8/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const std::string & host,
Poco::UInt16 port,
Context::Ptr pContext,
Session::Ptr pSession )

Creates a HTTPSClientSession using the given host and port, using the given SSL context.

◆ ~HTTPSClientSession()

Poco::Net::HTTPSClientSession::~HTTPSClientSession ( )

Creates a HTTPSClientSession using the given host and port, using the given SSL context.

The given Session is reused, if possible (client session caching is enabled for the given Context, and the server agrees to reuse the session).

◆ HTTPSClientSession() [9/9]

Poco::Net::HTTPSClientSession::HTTPSClientSession ( const HTTPSClientSession & )
private

Member Function Documentation

◆ abort()

void Poco::Net::HTTPSClientSession::abort ( )
virtual

Returns the SSL Session object for the current connection, if session caching has been enabled for the HTTPSClientSession's Context. A null pointer is returned otherwise.

The Session object can be obtained after the first request has been sent.

Reimplemented from Poco::Net::HTTPSession.

◆ connect()

void Poco::Net::HTTPSClientSession::connect ( const SocketAddress & address)
protectedvirtual

Refills the internal buffer.

Reimplemented from Poco::Net::HTTPSession.

◆ operator=()

HTTPSClientSession & Poco::Net::HTTPSClientSession::operator= ( const HTTPSClientSession & )
private

◆ proxyAuthenticate()

void Poco::Net::HTTPSClientSession::proxyAuthenticate ( HTTPRequest & request)
protectedvirtual

Checks if we can reuse a persistent connection.

Reimplemented from Poco::Net::HTTPClientSession.

◆ proxyRequestPrefix()

std::string Poco::Net::HTTPSClientSession::proxyRequestPrefix ( ) const
protectedvirtual

Sends the given HTTPRequest over an existing connection.

Reimplemented from Poco::Net::HTTPClientSession.

◆ read()

int Poco::Net::HTTPSClientSession::read ( char * buffer,
std::streamsize length )
protectedvirtual

Peeks at the next character in the buffer. Reads more data from the socket if there are no bytes left in the buffer.

Reimplemented from Poco::Net::HTTPSession.

◆ secure()

bool Poco::Net::HTTPSClientSession::secure ( ) const
virtual

Destroys the HTTPSClientSession and closes the underlying socket.

Reimplemented from Poco::Net::HTTPClientSession.

◆ serverCertificate()

X509Certificate Poco::Net::HTTPSClientSession::serverCertificate ( )

Return true iff the session uses SSL or TLS, or false otherwise.

◆ sslSession()

Session::Ptr Poco::Net::HTTPSClientSession::sslSession ( )

Returns the server's certificate.

The certificate is available after the first request has been sent.

Member Data Documentation

◆ _pContext

Context::Ptr Poco::Net::HTTPSClientSession::_pContext
private

Definition at line 157 of file HTTPSClientSession.h.

◆ _pSession

Session::Ptr Poco::Net::HTTPSClientSession::_pSession
private

Definition at line 158 of file HTTPSClientSession.h.


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