summaryrefslogtreecommitdiffstats
path: root/src/HTTP/UrlClient.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/HTTP/UrlClient.h')
-rw-r--r--src/HTTP/UrlClient.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/HTTP/UrlClient.h b/src/HTTP/UrlClient.h
index 42086a4f1..652cc76f7 100644
--- a/src/HTTP/UrlClient.h
+++ b/src/HTTP/UrlClient.h
@@ -5,7 +5,10 @@
/*
Options that can be set via the Options parameter to the cUrlClient calls:
-"MaxRedirects": The maximum number of allowed redirects before the client refuses a redirect with an error
+"MaxRedirects": The maximum number of allowed redirects before the client refuses a redirect with an error
+"OwnCert": The client certificate to use, if requested by the server. Any string that can be parsed by cX509Cert.
+"OwnPrivKey": The private key appropriate for OwnCert. Any string that can be parsed by cCryptoKey.
+"OwnPrivKeyPassword": The password for OwnPrivKey. If not present or empty, no password is assumed.
Behavior:
- If a redirect is received, and redirection is allowed, the redirection is reported via OnRedirecting() callback
@@ -34,8 +37,11 @@ public:
class cCallbacks
{
public:
+ // Force a virtual destructor in descendants:
+ virtual ~cCallbacks() {}
+
/** Called when the TCP connection is established. */
- virtual void OnConnected(cTCPLink & a_Link) {};
+ virtual void OnConnected(cTCPLink & a_Link) {}
/** Called for TLS connections, when the server certificate is received.
Return true to continue with the request, false to abort.
@@ -43,30 +49,34 @@ public:
TODO: The certificate parameter needs a representation! */
virtual bool OnCertificateReceived() { return true; }
+ /** Called for TLS connections, when the TLS handshake has been completed.
+ An empty default implementation is provided so that clients don't need to reimplement it unless they are interested in the event. */
+ virtual void OnTlsHandshakeCompleted() { }
+
/** Called after the entire request has been sent to the remote peer. */
- virtual void OnRequestSent() {};
+ virtual void OnRequestSent() {}
/** Called after the first line of the response is parsed, unless the response is an allowed redirect. */
virtual void OnStatusLine(const AString & a_HttpVersion, int a_StatusCode, const AString & a_Rest) {}
/** Called when a single HTTP header is received and parsed, unless the response is an allowed redirect
Called once for each incoming header. */
- virtual void OnHeader(const AString & a_Key, const AString & a_Value) {};
+ virtual void OnHeader(const AString & a_Key, const AString & a_Value) {}
/** Called when the HTTP headers have been fully parsed, unless the response is an allowed redirect.
There will be no more OnHeader() calls. */
- virtual void OnHeadersFinished() {};
+ virtual void OnHeadersFinished() {}
/** Called when the next fragment of the response body is received, unless the response is an allowed redirect.
This can be called multiple times, as data arrives over the network. */
- virtual void OnBodyData(const void * a_Data, size_t a_Size) {};
+ virtual void OnBodyData(const void * a_Data, size_t a_Size) {}
/** Called after the response body has been fully reported by OnBody() calls, unless the response is an allowed redirect.
There will be no more OnBody() calls. */
- virtual void OnBodyFinished() {};
+ virtual void OnBodyFinished() {}
/** Called when an asynchronous error is encountered. */
- virtual void OnError(const AString & a_ErrorMsg) {};
+ virtual void OnError(const AString & a_ErrorMsg) {}
/** Called when a redirect is to be followed.
This is called even if the redirecting is prohibited by the options; in such an event, this call will be
@@ -74,7 +84,7 @@ public:
If a response indicates a redirect (and the request allows redirecting), the regular callbacks
OnStatusLine(), OnHeader(), OnHeadersFinished(), OnBodyData() and OnBodyFinished() are not called
for such a response; instead, the redirect is silently attempted. */
- virtual void OnRedirecting(const AString & a_NewLocation) {};
+ virtual void OnRedirecting(const AString & a_NewLocation) {}
};