| Qore Programming Language Reference Manual 1.12.2

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
229 nothing clearProxyUserPassword();
230
231 public:
233
242 clearStats();
243
244 public:
246
253 nothing clearUserPassword();
254
255 public:
257
266 nothing clearWarningQueue();
267
268 public:
270
289 nothing connect();
290
291 public:
293
385 constructor(hash<auto> opts);
386
387 public:
389
394 constructor();
395
396 public:
398
400 copy();
401
402 public:
404
409 destructor();
410
411 public:
413
418 nothing disconnect();
419
420 public:
422
476 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
477
478 public:
480
493 string getAssumedEncoding();
494
495 public:
497
507 int getConnectTimeout();
508
509 public:
511
523 *string getConnectionPath();
524
525 public:
527
536 hash<string,string> getDefaultHeaders();
537
538 public:
540
550 string getDefaultPath();
551
552 public:
554
564 string getEncoding();
565
566 public:
568
583 bool getEncodingPassthru();
584
585 public:
587
603 bool getErrorPassthru();
604
605 public:
607
617 string getHTTPVersion();
618
619 public:
621
633 string getHostHeaderValue();
634
635 public:
637
647 int getMaxRedirects();
648
649 public:
651
661 bool getNoDelay();
662
663 public:
665
677 *string getProxyURL();
678
679 public:
681
695 bool getRedirectPassthru();
696
697 public:
699
714 *string getSafeProxyURL();
715
716 public:
718
733 *string getSafeURL();
734
735 public:
737
747 int getTimeout();
748
749 public:
751
764 *string getURL();
765
766 public:
768
789 hash<auto> getUsageInfo();
790
791 public:
793
841 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
842
843 public:
845
855 bool isConnected();
856
857 public:
859
869 bool isProxySecure();
870
871 public:
873
884 bool isSecure();
885
886 public:
888
940 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
941
942 public:
944
995 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
996
997 public:
999
1068 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1069
1070 public:
1072
1123 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1124
1125 public:
1127
1182 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);
1183
1184 public:
1186
1250 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);
1251
1252 public:
1254
1320 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1321
1322 public:
1324
1386 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1387
1388 public:
1390
1450 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1451
1452 public:
1454
1511 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1512
1513 public:
1515
1524 setAssumedEncoding(*string encoding);
1525
1526 public:
1528
1535 nothing setConnectTimeout(timeout timeout_ms = -1);
1536
1537 public:
1539
1548 setConnectionPath(*string uri_path);
1549
1550 public:
1552
1559 nothing setDefaultPath(*string path);
1560
1561 public:
1563
1570 nothing setEncoding(string encoding);
1571
1572 public:
1574
1589 bool setEncodingPassthru(bool set = True);
1590
1591 public:
1593
1610 bool setErrorPassthru(bool set = True);
1611
1612 public:
1614
1619 nothing setEventQueue();
1620
1621 public:
1623
1638 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1639
1640 public:
1642
1651 nothing setHTTPVersion(string ver);
1652
1653 public:
1655
1664 nothing setMaxRedirects(softint mr = 0);
1665
1666 public:
1668
1685 int setNoDelay(softbool b = True);
1686
1687 public:
1689
1701 setPersistent();
1702
1703 public:
1705
1712 nothing setProxySecure(softbool b = True);
1713
1714 public:
1716
1723 nothing setProxyURL();
1724
1725 public:
1727
1739 nothing setProxyURL(string url);
1740
1741 public:
1743
1753 nothing setProxyUserPassword(string user, string pass);
1754
1755 public:
1757
1768 nothing setProxyUserPassword();
1769
1770 public:
1772
1785 bool setRedirectPassthru(bool set = True);
1786
1787 public:
1789
1800 nothing setSecure(softbool secure = True);
1801
1802 public:
1804
1811 nothing setTimeout(timeout timeout_ms = 0);
1812
1813 public:
1815
1831 setURL(string url);
1832
1833 public:
1835
1845 nothing setUserPassword(string user, string pass);
1846
1847 public:
1849
1860 nothing setUserPassword();
1861
1862 public:
1864
1896 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1897
1898 public:
1900
1904 AbstractPollOperation startPollConnect();
1905
1906 public:
1908
1938 AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
1939
1940 public:
1942
1972 AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
1973 };
1974 }
Qore::AbstractPollOperation
Abstract poll operation objects provide the polling interface for pollable objects.
Definition: QC_AbstractPollOperation.dox.h:6
Qore::HTTPClient
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:199
Qore::HTTPClient::getHostHeaderValue
string getHostHeaderValue()
returns the Host header value for this object
Qore::HTTPClient::getEncodingPassthru
bool getEncodingPassthru()
get the encoding passthru status
Qore::HTTPClient::isProxySecure
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
Qore::HTTPClient::startPollSendRecv
AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
Qore::HTTPClient::setHTTPVersion
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1....
Qore::HTTPClient::setErrorPassthru
bool setErrorPassthru(bool set=True)
set the error passthru status
Qore::HTTPClient::constructor
constructor()
Creates the HTTPClient object.
Qore::HTTPClient::getConnectionPath
*string getConnectionPath()
Returns the current connection path set in the URL.
Qore::HTTPClient::setProxyURL
nothing setProxyURL(string url)
Sets a new proxy URL value for the next connection.
Qore::HTTPClient::getDefaultPath
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
Qore::HTTPClient::sendChunked
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...
Qore::HTTPClient::setPersistent
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected
Qore::HTTPClient::getProxyURL
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
Qore::HTTPClient::sendWithRecvCallback
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...
Qore::HTTPClient::getNoDelay
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
Qore::HTTPClient::clearWarningQueue
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
Qore::HTTPClient::sendWithRecvCallback
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...
Qore::HTTPClient::getSafeProxyURL
*string getSafeProxyURL()
Returns the current proxy URL without the password field.
Qore::HTTPClient::getHTTPVersion
string getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
Qore::HTTPClient::setEncodingPassthru
bool setEncodingPassthru(bool set=True)
set the encoding passthru status
Qore::HTTPClient::isSecure
bool isSecure()
Returns True if the current connection is encrypted, False if not.
Qore::HTTPClient::setConnectTimeout
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
Qore::HTTPClient::getAssumedEncoding
string getAssumedEncoding()
returns the assumed character encoding for messages from the HTTP server without any charset indicato...
Qore::HTTPClient::startPollSendRecv
AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
Qore::HTTPClient::setSecure
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...
Qore::HTTPClient::send
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.
Qore::HTTPClient::clearStats
clearStats()
Clears performance statistics.
Qore::HTTPClient::send
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...
Qore::HTTPClient::getErrorPassthru
bool getErrorPassthru()
get the error passthru status
Qore::HTTPClient::connect
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
Qore::HTTPClient::getConnectTimeout
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
Qore::HTTPClient::setURL
setURL(string url)
Sets a new URL value for the next connection.
Qore::HTTPClient::setEncoding
nothing setEncoding(string encoding)
Sets the string encoding for the object; any strings deserialized with this object will be tagged wit...
Qore::HTTPClient::setDefaultPath
nothing setDefaultPath(*string path)
Sets the default path used by the object if no path is set in the URL.
Qore::HTTPClient::post
*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...
Qore::HTTPClient::getEncoding
string getEncoding()
Returns the character encoding used for the object.
Qore::HTTPClient::clearUserPassword
nothing clearUserPassword()
Clears the username and password for the connection.
Qore::HTTPClient::send
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...
Qore::HTTPClient::getURL
*string getURL()
Returns the current URL.
Qore::HTTPClient::setConnectionPath
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
Qore::HTTPClient::sendWithCallbacks
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;...
Qore::HTTPClient::setUserPassword
nothing setUserPassword(string user, string pass)
Sets the username and password for the connection; call after HTTPClient::setURL()
Qore::HTTPClient::copy
copy()
Copying objects of this class is not supported, an exception will be thrown.
Qore::HTTPClient::head
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.
Qore::HTTPClient::constructor
constructor(hash< auto > opts)
Creates the HTTPClient object based on the option parameter passed.
Qore::HTTPClient::setUserPassword
nothing setUserPassword()
Clears the username and password for the connection.
Qore::HTTPClient::setEventQueue
nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data)
Sets a Queue object to receive HTTPClient and Socket events.
Qore::HTTPClient::getSafeURL
*string getSafeURL()
Returns the current URL without the password field.
Qore::HTTPClient::post
*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...
Qore::HTTPClient::get
*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 ...
Qore::HTTPClient::sendWithSendCallback
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 ...
Qore::HTTPClient::addDefaultHeaders
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
Qore::HTTPClient::clearProxyUserPassword
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
Qore::HTTPClient::clearProxyURL
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
Qore::HTTPClient::getTimeout
int getTimeout()
Returns the default I/O timeout as an integer in milliseconds.
Qore::HTTPClient::destructor
destructor()
Destroys the HTTPClient object and closes any open connections.
Qore::HTTPClient::isConnected
bool isConnected()
Returns True or False giving the current connection state.
Qore::HTTPClient::getRedirectPassthru
bool getRedirectPassthru()
get the redirect passthru status
Qore::HTTPClient::setWarningQueue
nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms=1s)
Sets a Queue object to receive socket warnings.
Qore::HTTPClient::setProxySecure
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
Qore::HTTPClient::setNoDelay
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
Qore::HTTPClient::getUsageInfo
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
Qore::HTTPClient::setMaxRedirects
nothing setMaxRedirects(softint mr=0)
Updates the setting for the max_redirects value for the object (maximum number of HTTP redirects that...
Qore::HTTPClient::disconnect
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing)
Qore::HTTPClient::setAssumedEncoding
setAssumedEncoding(*string encoding)
sets the assumed character encoding for messages from the HTTP server without any charset indicator
Qore::HTTPClient::setProxyURL
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
Qore::HTTPClient::setRedirectPassthru
bool setRedirectPassthru(bool set=True)
set the redirect passthru status
Qore::HTTPClient::getDefaultHeaders
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
Qore::HTTPClient::setEventQueue
nothing setEventQueue()
Clears any Queue object that may be set on the HTTPClient object so that I/O events are no longer cap...
Qore::HTTPClient::setProxyUserPassword
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
Qore::HTTPClient::setTimeout
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
Qore::HTTPClient::setProxyUserPassword
nothing setProxyUserPassword(string user, string pass)
Sets the username and password for the connection to the proxy; call after HTTPClient::setProxyURL()
Qore::HTTPClient::getMaxRedirects
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
Qore::HTTPClient::startPollConnect
AbstractPollOperation startPollConnect()
Returns an AbstractPollOperation object to make a non-blocking HTTP connection.
Qore::InputStream
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:19
Qore::OutputStream
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:18
Qore::Socket
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:152
Qore::Thread::Queue
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:22
Qore::True
const True
logical True
Definition: qc_qore.dox.h:98
Qore::False
const False
logical False
Definition: qc_qore.dox.h:96
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)
Qore
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3