$darkmode
Qore Programming Language Reference Manual 1.19.2
QC_HTTPClient.dox.h
1 
3 namespace Qore {
5 
200 class HTTPClient : public Socket {
201 
202 public:
204 
210 nothing addDefaultHeaders(hash<auto> hdr);
211 
212 public:
214 
219 nothing clearProxyURL();
220 
221 public:
223 
232 
233 public:
235 
245 
246 public:
248 
257 
258 public:
260 
270 
271 public:
273 
292 nothing connect();
293 
294 public:
296 
397  constructor(hash<auto> opts);
398 
399 public:
401 
407 
408 public:
410 
412  copy();
413 
414 public:
416 
422 
423 public:
425 
430 nothing disconnect();
431 
432 public:
434 
488 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
489 
490 public:
492 
506 
507 public:
509 
521 
522 public:
524 
537 
538 public:
540 
549 hash<string,string> getDefaultHeaders();
550 
551 public:
553 
563 string getDefaultPath();
564 
565 public:
567 
577 string getEncoding();
578 
579 public:
581 
597 
598 public:
600 
617 
618 public:
620 
630 string getHTTPVersion();
631 
632 public:
634 
647 
648 public:
650 
661 
662 public:
664 
674 bool getNoDelay();
675 
676 public:
678 
685 *string getPassword();
686 
687 public:
689 
706 
707 public:
709 
717 
718 public:
720 
732 *string getProxyURL();
733 
734 public:
736 
744 
745 public:
747 
762 
763 public:
765 
780 *string getSafeProxyURL();
781 
782 public:
784 
799 *string getSafeURL();
800 
801 public:
803 
814 
815 public:
817 
830 *string getURL();
831 
832 public:
834 
860 hash<auto> getUsageInfo();
861 
862 public:
864 
871 *string getUsername();
872 
873 public:
875 
923 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
924 
925 public:
927 
937 bool isConnected();
938 
939 public:
941 
952 
953 public:
955 
966 bool isSecure();
967 
968 public:
970 
1022 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
1023 
1024 public:
1026 
1077 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
1078 
1079 public:
1081 
1152 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1153 
1154 public:
1156 
1213 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1214 
1215 public:
1217 
1274 nothing send(Qore::OutputStream os, *data body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info, *code rcb);
1275 
1276 public:
1278 
1344 nothing sendChunked(Qore::OutputStream os, Qore::InputStream is, string method, int max_chunk_size = 4096, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info, *code rcb, *code tcb);
1345 
1346 public:
1348 
1420 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1421 
1422 public:
1424 
1492 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1493 
1494 public:
1496 
1562 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1563 
1564 public:
1566 
1629 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1630 
1631 public:
1633 
1642  setAssumedEncoding(*string encoding);
1643 
1644 public:
1646 
1656 nothing setConnectTimeout(timeout timeout_ms = -1);
1657 
1658 public:
1660 
1669  setConnectionPath(*string uri_path);
1670 
1671 public:
1673 
1680 nothing setDefaultPath(*string path);
1681 
1682 public:
1684 
1691 nothing setEncoding(string encoding);
1692 
1693 public:
1695 
1710 bool setEncodingPassthru(bool set = True);
1711 
1712 public:
1714 
1731 bool setErrorPassthru(bool set = True);
1732 
1733 public:
1735 
1740 nothing setEventQueue();
1741 
1742 public:
1744 
1760 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1761 
1762 public:
1764 
1773 nothing setHTTPVersion(string ver);
1774 
1775 public:
1777 
1786 nothing setMaxRedirects(softint mr = 0);
1787 
1788 public:
1790 
1813 int setNoDelay(softbool b = True);
1814 
1815 public:
1817 
1831 
1832 public:
1834 
1851 bool setPreEncodedUrls(bool set = True);
1852 
1853 public:
1855 
1862 nothing setProxySecure(softbool b = True);
1863 
1864 public:
1866 
1873 nothing setProxyURL();
1874 
1875 public:
1877 
1889 nothing setProxyURL(string url);
1890 
1891 public:
1893 
1904 nothing setProxyUserPassword(string user, string pass);
1905 
1906 public:
1908 
1921 
1922 public:
1924 
1937 bool setRedirectPassthru(bool set = True);
1938 
1939 public:
1941 
1952 nothing setSecure(softbool secure = True);
1953 
1954 public:
1956 
1963 nothing setTimeout(timeout timeout_ms = 0);
1964 
1965 public:
1967 
1983  setURL(string url);
1984 
1985 public:
1987 
1998 nothing setUserPassword(string user, string pass);
1999 
2000 public:
2002 
2015 
2016 public:
2018 
2059 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
2060 
2061 public:
2063 
2068 
2069 public:
2071 
2101 AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
2102 
2103 public:
2105 
2135 AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
2136 };
2137 }
Abstract poll operation objects provide the polling interface for pollable objects.
Definition: QC_AbstractPollOperation.dox.h:6
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:200
string getHostHeaderValue()
returns the Host header value for this object
bool getEncodingPassthru()
get the encoding passthru status
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
*string getProxyUsername()
Returns any username set for the proxy connection, if any.
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1....
bool setErrorPassthru(bool set=True)
set the error passthru status
constructor()
Creates the HTTPClient object.
*string getConnectionPath()
Returns the current connection path set in the URL.
nothing setProxyURL(string url)
Sets a new proxy URL value for the next connection.
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
nothing sendChunked(Qore::OutputStream os, Qore::InputStream is, string method, int max_chunk_size=4096, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash< auto >> info, *code rcb, *code tcb)
Sends a chunked HTTP request with the specified method and message body; headers are returned through...
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash< auto >> info)
Sends an HTTP request with the specified method and optional message body; headers and any body recei...
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
*string getPassword()
Returns any password set for the connection.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash< auto >> info)
Sends an HTTP request with the specified method and optional message body; headers and any body recei...
*string getSafeProxyURL()
Returns the current proxy URL without the password field.
string getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
bool setEncodingPassthru(bool set=True)
set the encoding passthru status
bool isSecure()
Returns True if the current connection is encrypted, False if not.
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
string getAssumedEncoding()
returns the assumed character encoding for messages from the HTTP server without any charset indicato...
AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
nothing setSecure(softbool secure=True)
Sets the object to make a secure SSL/TLS connection on the next connect if the passed argument is Tru...
hash< auto > send(string body, string method, *string path, *hash< auto > headers, softbool getbody=False, *reference< hash< auto >> info)
Sends an HTTP request with the specified method and optional message body.
clearStats()
Clears performance statistics.
*string getProxyPassword()
Returns any password set for the proxy connection, if any.
bool getPreEncodedUrls()
get the pre-encoded URL flag
hash< auto > send(*binary body, string method, *string path, *hash< auto > headers, softbool getbody=False, *reference< hash< auto >> info)
Sends an HTTP request with the specified method and optional message body and returns headers and any...
bool getErrorPassthru()
get the error passthru status
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
setURL(string url)
Sets a new URL value for the next connection.
nothing setEncoding(string encoding)
Sets the string encoding for the object; any strings deserialized with this object will be tagged wit...
nothing setDefaultPath(*string path)
Sets the default path used by the object if no path is set in the URL.
*string post(string path, *binary body, *hash< auto > headers, *reference< hash< auto >> info)
Sends an HTTP POST request with a message body and returns the message body received as a string or N...
bool setPreEncodedUrls(bool set=True)
set the pre-encoded URL flag
*string getUsername()
Returns any username set for the connection.
string getEncoding()
Returns the character encoding used for the object.
nothing clearUserPassword()
Clears the username and password for the connection.
nothing send(Qore::OutputStream os, *data body, string method, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash< auto >> info, *code rcb)
Sends an HTTP request with the specified method and optional message body; headers are returned throu...
*string getURL()
Returns the current URL.
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash< auto >> info)
Sends an HTTP request with the specified method and chunked message body as given by a send callback;...
nothing setUserPassword(string user, string pass)
Sets the username and password for the connection; call after HTTPClient::setURL()
copy()
Copying objects of this class is not supported, an exception will be thrown.
hash< auto > head(string path, *hash< auto > headers, *reference< hash< auto >> info)
Sends an HTTP HEAD request and returns as hash of the headers received.
constructor(hash< auto > opts)
Creates the HTTPClient object based on the option parameter passed.
nothing setUserPassword()
Clears the username and password for the connection.
nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive HTTPClient and Socket events.
*string getSafeURL()
Returns the current URL without the password field.
*string post(string path, string body, *hash< auto > headers, *reference< hash< auto >> info)
Sends an HTTP POST request with a message body and returns the message body received as a string or N...
*string get(string path, *hash< auto > headers, *reference< hash< auto >> info)
Sends an HTTP GET request and returns the message body received as a string or NOTHING if no message ...
hash< auto > sendWithSendCallback(code scb, string method, *string path, *hash< auto > headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash > info)
Sends an HTTP request with the specified method and chunked message body as given by a send callback ...
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
int getTimeout()
Returns the default I/O timeout as an integer in milliseconds.
destructor()
Destroys the HTTPClient object and closes any open connections.
bool isConnected()
Returns True or False giving the current connection state.
bool getRedirectPassthru()
get the redirect passthru status
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
nothing setMaxRedirects(softint mr=0)
Updates the setting for the max_redirects value for the object (maximum number of HTTP redirects that...
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing)
setAssumedEncoding(*string encoding)
sets the assumed character encoding for messages from the HTTP server without any charset indicator
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
bool setRedirectPassthru(bool set=True)
set the redirect passthru status
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
nothing setEventQueue()
Clears any Queue object that may be set on the HTTPClient object so that I/O events are no longer cap...
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
nothing setProxyUserPassword(string user, string pass)
Sets the username and password for the connection to the proxy; call after HTTPClient::setProxyURL()
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
AbstractPollOperation startPollConnect()
Returns an AbstractPollOperation object to make a non-blocking HTTP connection.
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:19
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:18
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:152
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:22
const True
logical True
Definition: qc_qore.dox.h:98
const False
logical False
Definition: qc_qore.dox.h:96
binary binary()
Always returns an empty binary object (of zero length)
Qore namespace.
Definition: QC_AbstractBidirectionalIterator.dox.h:2