Qore Programming Language Reference Manual  1.11.0
QC_HTTPClient.dox.h
1 
3 namespace Qore {
5 
199 class HTTPClient : public Socket {
200 
201 public:
203 
209 nothing addDefaultHeaders(hash<auto> hdr);
210 
211 public:
213 
218 nothing clearProxyURL();
219 
220 public:
222 
230 
231 public:
233 
243 
244 public:
246 
254 
255 public:
257 
267 
268 public:
270 
284 nothing connect();
285 
286 public:
288 
380  constructor(hash<auto> opts);
381 
382 public:
384 
390 
391 public:
393 
395  copy();
396 
397 public:
399 
405 
406 public:
408 
413 nothing disconnect();
414 
415 public:
417 
471 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
472 
473 public:
475 
489 
490 public:
492 
503 
504 public:
506 
519 
520 public:
522 
531 hash<string,string> getDefaultHeaders();
532 
533 public:
535 
545 string getDefaultPath();
546 
547 public:
549 
559 string getEncoding();
560 
561 public:
563 
579 
580 public:
582 
599 
600 public:
602 
612 string getHTTPVersion();
613 
614 public:
616 
629 
630 public:
632 
643 
644 public:
646 
656 bool getNoDelay();
657 
658 public:
660 
672 *string getProxyURL();
673 
674 public:
676 
691 
692 public:
694 
709 *string getSafeProxyURL();
710 
711 public:
713 
728 *string getSafeURL();
729 
730 public:
732 
743 
744 public:
746 
759 *string getURL();
760 
761 public:
763 
784 hash<auto> getUsageInfo();
785 
786 public:
788 
836 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
837 
838 public:
840 
850 bool isConnected();
851 
852 public:
854 
865 
866 public:
868 
879 bool isSecure();
880 
881 public:
883 
935 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
936 
937 public:
939 
990 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
991 
992 public:
994 
1046 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1047 
1048 public:
1050 
1101 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1102 
1103 public:
1105 
1160 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);
1161 
1162 public:
1164 
1228 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);
1229 
1230 public:
1232 
1298 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1299 
1300 public:
1302 
1364 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1365 
1366 public:
1368 
1428 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1429 
1430 public:
1432 
1489 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1490 
1491 public:
1493 
1502  setAssumedEncoding(*string encoding);
1503 
1504 public:
1506 
1513 nothing setConnectTimeout(timeout timeout_ms = -1);
1514 
1515 public:
1517 
1526  setConnectionPath(*string uri_path);
1527 
1528 public:
1530 
1537 nothing setDefaultPath(*string path);
1538 
1539 public:
1541 
1548 nothing setEncoding(string encoding);
1549 
1550 public:
1552 
1567 bool setEncodingPassthru(bool set = True);
1568 
1569 public:
1571 
1588 bool setErrorPassthru(bool set = True);
1589 
1590 public:
1592 
1597 nothing setEventQueue();
1598 
1599 public:
1601 
1616 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1617 
1618 public:
1620 
1629 nothing setHTTPVersion(string ver);
1630 
1631 public:
1633 
1642 nothing setMaxRedirects(softint mr = 0);
1643 
1644 public:
1646 
1663 int setNoDelay(softbool b = True);
1664 
1665 public:
1667 
1680 
1681 public:
1683 
1690 nothing setProxySecure(softbool b = True);
1691 
1692 public:
1694 
1701 nothing setProxyURL();
1702 
1703 public:
1705 
1717 nothing setProxyURL(string url);
1718 
1719 public:
1721 
1731 nothing setProxyUserPassword(string user, string pass);
1732 
1733 public:
1735 
1747 
1748 public:
1750 
1763 bool setRedirectPassthru(bool set = True);
1764 
1765 public:
1767 
1778 nothing setSecure(softbool secure = True);
1779 
1780 public:
1782 
1789 nothing setTimeout(timeout timeout_ms = 0);
1790 
1791 public:
1793 
1809  setURL(string url);
1810 
1811 public:
1813 
1823 nothing setUserPassword(string user, string pass);
1824 
1825 public:
1827 
1839 
1840 public:
1842 
1874 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1875 };
1876 }
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:199
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.
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.
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...
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 and returns headers and any...
clearStats()
Clears performance statistics.
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...
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...
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:150
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)
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3