QoreHTTPClient Class Reference

provides a way to communicate with HTTP servers using Qore data structures More...

`#include <QoreHTTPClient.h>`

Inheritance diagram for QoreHTTPClient:
[legend]
Collaboration diagram for QoreHTTPClient:
[legend]

## Public Member Functions

DLLEXPORT | QoreHTTPClient ()
| creates the QoreHTTPClient object
virtual DLLEXPORT | ~QoreHTTPClient ()
| destroys the object and frees all associated memory
Public Member Functions inherited from QoreHttpClientObject
DLLEXPORT | QoreHttpClientObject ()
| creates the QoreHttpClientObject object
virtual DLLEXPORT | ~QoreHttpClientObject ()
| destroys the object and frees all associated memory
DLLEXPORT void | addDefaultHeaders (const QoreHashNode *hdr)
| Sets the value of multiple headers to send with every outgoing message. More...
DLLEXPORT void | addProtocol (const char *prot, int port, bool ssl=false)
| adds a protocol More...
DLLEXPORT void | clearProxyURL ()
| clears the proxy URL
DLLEXPORT void | clearProxyUserPassword ()
| clears the username and password for the proxy connection
DLLEXPORT void | clearUserPassword ()
| clears the username and password for the connection
DLLEXPORT int | connect (ExceptionSink *xsink)
| opens a connection and returns a code giving the result More...
virtual DLLLOCAL void | deref (ExceptionSink *xsink)
| decrements the reference count of the object More...
virtual DLLLOCAL void | deref ()
| decrements the reference count of the object without the possibility of throwing a Qore-language exception
virtual DLLEXPORT void | deref (ExceptionSink *xsink)
| decrements the reference count and deletes the object when it reaches 0 More...
DLLEXPORT void | disconnect ()
| disconnects from the remote server
DLLEXPORT AbstractQoreNode * | get (const char *path, const QoreHashNode *headers, QoreHashNode *info, ExceptionSink *xsink)
| sends an HTTP "GET" method and returns the value of the message body returned, the caller owns the AbstractQoreNode reference returned More...
DLLEXPORT QoreStringNode * | getAssumedEncoding () const
| gets the assumed encoding More...
DLLEXPORT const char * | getConnectionPath () const
| returns the current connection path or 0 if none is set More...
DLLEXPORT int | getConnectTimeout () const
| returns the connect timeout in ms, negative numbers mean no timeout More...
DLLEXPORT QoreHashNode * | getDefaultHeaders () const
| Returns a hash of default headers to be sent with every outgoing request. More...
DLLEXPORT const char * | getDefaultPath () const
| returns the default path or 0 if none is set More...
DLLEXPORT const QoreEncoding * | getEncoding () const
| returns the default encoding for the object
DLLEXPORT bool | getEncodingPassthru () const
| returns the current encoding_passthru status More...
DLLEXPORT bool | getErrorPassthru () const
| returns the current error_passthru status More...
DLLEXPORT QoreStringNode * | getHostHeaderValue () const
| returns the `Host` header value More...
DLLEXPORT const char * | getHTTPVersion () const
| returns the http version as a string (either "1.0" or "1.1") More...
DLLEXPORT int | getMaxRedirects () const
| returns the value of the max_redirects option
DLLEXPORT bool | getNoDelay () const
| returns the value of the TCP_NODELAY flag on the object
DLLEXPORT QoreStringNode * | getProxyURL ()
| returns the proxy connection parameters as a URL (or 0 if there is none), caller owns the reference count returned More...
DLLEXPORT bool | getRedirectPassthru () const
| returns the current redirect_passthru status More...
DLLEXPORT int | getTimeout () const
| returns the connection and response packet timeout value in milliseconds
DLLEXPORT QoreStringNode * | getURL ()
| returns the connection parameters as a URL, caller owns the reference count returned More...
DLLEXPORT QoreHashNode * | head (const char *path, const QoreHashNode *headers, QoreHashNode *info, ExceptionSink *xsink)
| sends an HTTP "HEAD" method and returns the headers returned, the caller owns the QoreHashNode reference returned More...
DLLEXPORT bool | isConnected () const
| returns the connection status of the object
DLLEXPORT bool | isHTTP11 () const
| returns true if HTTP 1.1 protocol compliance has been set
DLLEXPORT bool | isProxySecure () const
| returns the SSL proxy connection parameter flag
DLLEXPORT bool | isSecure () const
| returns the SSL connection parameter flag
DLLEXPORT AbstractQoreNode * | post (const char *path, const QoreHashNode *headers, const void *data, unsigned size, QoreHashNode *info, ExceptionSink *xsink)
| sends an HTTP "POST" message to the remote server and returns the message body of the response, caller owns the AbstractQoreNode reference returned More...
DLLEXPORT AbstractQoreNode * | post (const char *path, const QoreHashNode *headers, const QoreStringNode &body, QoreHashNode *info, ExceptionSink *xsink)
| sends an HTTP "POST" message to the remote server and returns the message body of the response, caller owns the AbstractQoreNode reference returned More...
DLLEXPORT QoreHashNode * | send (const char *meth, const char *path, const QoreHashNode *headers, const void *data, unsigned size, bool getbody, QoreHashNode *info, ExceptionSink *xsink)
| sends a message to the remote server and returns the entire response as a hash, caller owns the QoreHashNode reference returned More...
DLLEXPORT void | sendChunked (const char *meth, const char *mpath, const QoreHashNode *headers, bool getbody, QoreHashNode *info, int timeout_ms, const ResolvedCallReferenceNode *recv_callback, QoreObject *obj, OutputStream *os, InputStream *is, size_t max_chunk_size, const ResolvedCallReferenceNode *trailer_callback, ExceptionSink *xsink)
| send a chunked HTTP message through an InputStream and receive the response to an OutputStream More...
DLLEXPORT void | sendWithOutputStream (const char *meth, const char *mpath, const QoreHashNode *headers, const void *data, unsigned size, bool getbody, QoreHashNode *info, int timeout_ms, const ResolvedCallReferenceNode *recv_callback, QoreObject *obj, OutputStream *os, ExceptionSink *xsink)
| make an HTTP request and receive the response to an OutputStream More...
DLLEXPORT void | sendWithOutputStream (const char *meth, const char *mpath, const QoreHashNode *headers, const QoreStringNode &body, bool getbody, QoreHashNode *info, int timeout_ms, const ResolvedCallReferenceNode *recv_callback, QoreObject *obj, OutputStream *os, ExceptionSink *xsink)
| make an HTTP request and receive the response to an OutputStream More...
DLLEXPORT void | setAssumedEncoding (const char *enc)
| sets the assumed encoding More...
DLLEXPORT void | setConnectionPath (const char *path)
| sets or clears the connection path More...
DLLEXPORT void | setConnectTimeout (int ms)
| sets the connect timeout in ms More...
DLLEXPORT void | setDefaultHeaderValue (const char *header, const char *val)
| sets the value of a default header to send with every outgoing message More...
DLLEXPORT void | setDefaultPath (const char *pth)
| sets the default path More...
DLLEXPORT void | setDefaultPort (int prt)
| sets the default port More...
DLLEXPORT void | setEncoding (const QoreEncoding *qe)
| sets the default encoding for the object
DLLEXPORT bool | setEncodingPassthru (bool set)
| sets the new and returns the old encoding_passthru status More...
DLLEXPORT bool | setErrorPassthru (bool set)
| sets the new and returns the old error_passthru status More...
DLLEXPORT void | setEventQueue (Queue *cbq, ExceptionSink *xsink)
| sets the event queue, must be already referenced before call
DLLEXPORT void | setEventQueue (ExceptionSink *xsink, Queue *q, QoreValue arg, bool with_data)
| sets the event queue, must be already referenced before call
DLLEXPORT void | setHTTP11 (bool h11)
| sets or clears HTTP 1.1 protocol compliance More...
DLLEXPORT int | setHTTPVersion (const char *version, ExceptionSink *xsink)
| sets the http version from a string More...
DLLEXPORT void | setMaxRedirects (int max)
| sets the max_redirects option
DLLEXPORT int | setNoDelay (bool nodelay)
| sets the TCP_NODELAY flag on the object More...
DLLEXPORT int | setOptions (const QoreHashNode *opts, ExceptionSink *xsink)
| set options with a hash, returns -1 if an exception was thrown, 0 for OK More...
DLLEXPORT void | setPersistent (ExceptionSink *xsink)
| temporarily disables implicit reconnections; must be called when the server is already connected
DLLEXPORT void | setProxySecure (bool is_secure)
| sets the SSL flag for use in the next connection to the proxy
DLLEXPORT int | setProxyURL (const char *proxy, ExceptionSink *xsink)
| sets the proxy URL More...
DLLEXPORT void | setProxyUserPassword (const char *user, const char *pass)
| sets the username and password for the proxy connection More...
DLLEXPORT bool | setRedirectPassthru (bool set)
| sets the new and returns the old redirect_passthru status More...
DLLEXPORT void | setSecure (bool is_secure)
| sets the SSL flag for use in the next connection
DLLEXPORT void | setTimeout (int to)
| sets the connection and response packet timeout value in milliseconds
DLLEXPORT int | setURL (const char *url, ExceptionSink *xsink)
| sets the connection URL More...
DLLEXPORT void | setUserPassword (const char *user, const char *pass)
| sets the username and password for the connection More...

## Detailed Description

provides a way to communicate with HTTP servers using Qore data structures

thread-safe, uses QoreSocket for socket communication

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

- include/qore/QoreHTTPClient.h