Ark Server API (ASE) - Wiki
|
#include <HTTPSClientSession.h>
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 ProxyConfig & | getProxyConfig () const |
Sets the proxy configuration. | |
void | setKeepAliveTimeout (const Poco::Timespan &timeout) |
Returns the global proxy configuration. | |
const Poco::Timespan & | getKeepAliveTimeout () 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::Exception * | networkException () const |
void | attachSessionData (const Poco::Any &data) |
const Poco::Any & | sessionData () const |
StreamSocket | detachSocket () |
StreamSocket & | socket () |
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 &) | |
HTTPSClientSession & | operator= (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 ProxyConfig & | getGlobalProxyConfig () |
Protected Types inherited from Poco::Net::HTTPClientSession | |
enum | { DEFAULT_KEEP_ALIVE_TIMEOUT = 8 } |
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.
anonymous enum |
Enumerator | |
---|---|
HTTPS_PORT |
Definition at line 73 of file HTTPSClientSession.h.
Poco::Net::HTTPSClientSession::HTTPSClientSession | ( | ) |
|
explicit |
Creates an unconnected HTTPSClientSession.
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.
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).
|
explicit |
Creates a HTTPSClientSession using the given host and port.
Poco::Net::HTTPSClientSession::HTTPSClientSession | ( | Context::Ptr | pContext, |
Session::Ptr | pSession ) |
Creates an unconnected HTTPSClientSession, using the give SSL context.
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).
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.
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).
|
private |
|
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.
|
protectedvirtual |
Refills the internal buffer.
Reimplemented from Poco::Net::HTTPSession.
|
private |
|
protectedvirtual |
Checks if we can reuse a persistent connection.
Reimplemented from Poco::Net::HTTPClientSession.
|
protectedvirtual |
Sends the given HTTPRequest over an existing connection.
Reimplemented from Poco::Net::HTTPClientSession.
|
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.
|
virtual |
Destroys the HTTPSClientSession and closes the underlying socket.
Reimplemented from Poco::Net::HTTPClientSession.
X509Certificate Poco::Net::HTTPSClientSession::serverCertificate | ( | ) |
Return true iff the session uses SSL or TLS, or false otherwise.
Session::Ptr Poco::Net::HTTPSClientSession::sslSession | ( | ) |
Returns the server's certificate.
The certificate is available after the first request has been sent.
|
private |
Definition at line 157 of file HTTPSClientSession.h.
|
private |
Definition at line 158 of file HTTPSClientSession.h.