Qore Programming Language Reference Manual  0.9.10
QC_HTTPClient.dox.h
1 
3 namespace Qore {
5 
163 class HTTPClient : public Socket {
164 
165 public:
167 
173 nothing addDefaultHeaders(hash<auto> hdr);
174 
175 public:
177 
182 nothing clearProxyURL();
183 
184 public:
186 
194 
195 public:
197 
207 
208 public:
210 
218 
219 public:
221 
231 
232 public:
234 
248 nothing connect();
249 
250 public:
252 
315  constructor(hash<auto> opts);
316 
317 public:
319 
325 
326 public:
328 
330  copy();
331 
332 public:
334 
340 
341 public:
343 
348 nothing disconnect();
349 
350 public:
352 
406 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
407 
408 public:
410 
424 
425 public:
427 
438 
439 public:
441 
454 
455 public:
457 
466 hash<string,string> getDefaultHeaders();
467 
468 public:
470 
480 string getDefaultPath();
481 
482 public:
484 
494 string getEncoding();
495 
496 public:
498 
514 
515 public:
517 
534 
535 public:
537 
547 string getHTTPVersion();
548 
549 public:
551 
564 
565 public:
567 
578 
579 public:
581 
591 bool getNoDelay();
592 
593 public:
595 
605 *string getProxyURL();
606 
607 public:
609 
624 
625 public:
627 
638 
639 public:
641 
651 *string getURL();
652 
653 public:
655 
676 hash<auto> getUsageInfo();
677 
678 public:
680 
728 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
729 
730 public:
732 
742 bool isConnected();
743 
744 public:
746 
757 
758 public:
760 
771 bool isSecure();
772 
773 public:
775 
827 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
828 
829 public:
831 
882 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
883 
884 public:
886 
938 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
939 
940 public:
942 
993 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
994 
995 public:
997 
1052 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);
1053 
1054 public:
1056 
1119 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);
1120 
1121 public:
1123 
1189 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1190 
1191 public:
1193 
1255 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1256 
1257 public:
1259 
1319 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1320 
1321 public:
1323 
1380 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1381 
1382 public:
1384 
1393  setAssumedEncoding(*string encoding);
1394 
1395 public:
1397 
1404 nothing setConnectTimeout(timeout timeout_ms = -1);
1405 
1406 public:
1408 
1417  setConnectionPath(*string uri_path);
1418 
1419 public:
1421 
1428 nothing setDefaultPath(*string path);
1429 
1430 public:
1432 
1439 nothing setEncoding(string encoding);
1440 
1441 public:
1443 
1458 bool setEncodingPassthru(bool set = True);
1459 
1460 public:
1462 
1479 bool setErrorPassthru(bool set = True);
1480 
1481 public:
1483 
1488 nothing setEventQueue();
1489 
1490 public:
1492 
1507 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1508 
1509 public:
1511 
1520 nothing setHTTPVersion(string ver);
1521 
1522 public:
1524 
1533 nothing setMaxRedirects(softint mr = 0);
1534 
1535 public:
1537 
1554 int setNoDelay(softbool b = True);
1555 
1556 public:
1558 
1571 
1572 public:
1574 
1581 nothing setProxySecure(softbool b = True);
1582 
1583 public:
1585 
1592 nothing setProxyURL();
1593 
1594 public:
1596 
1608 nothing setProxyURL(string url);
1609 
1610 public:
1612 
1622 nothing setProxyUserPassword(string user, string pass);
1623 
1624 public:
1626 
1638 
1639 public:
1641 
1654 bool setRedirectPassthru(bool set = True);
1655 
1656 public:
1658 
1669 nothing setSecure(softbool secure = True);
1670 
1671 public:
1673 
1680 nothing setTimeout(timeout timeout_ms = 0);
1681 
1682 public:
1684 
1700  setURL(string url);
1701 
1702 public:
1704 
1714 nothing setUserPassword(string user, string pass);
1715 
1716 public:
1718 
1730 
1731 public:
1733 
1765 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1766 };
1767 }
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::disconnect
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing)
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::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
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:163
Qore::HTTPClient::isSecure
bool isSecure()
Returns True if the current connection is encrypted, False if not.
Qore::HTTPClient::isConnected
bool isConnected()
Returns True or False giving the current connection state.
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::constructor
constructor()
Creates the HTTPClient object.
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 and returns headers and any...
Qore::HTTPClient::setEncodingPassthru
bool setEncodingPassthru(bool set=True)
set the encoding passthru status
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::setProxyURL
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
Qore::HTTPClient::getAssumedEncoding
string getAssumedEncoding()
returns the assumed character encoding for messages from the HTTP server without any charset indicato...
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::clearProxyURL
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
Qore::HTTPClient::setConnectionPath
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
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::getRedirectPassthru
bool getRedirectPassthru()
get the redirect passthru status
Qore::HTTPClient::setAssumedEncoding
setAssumedEncoding(*string encoding)
sets the assumed character encoding for messages from the HTTP server without any charset indicator
Qore::HTTPClient::getURL
*string getURL()
Returns the current URL.
Qore::HTTPClient::getEncodingPassthru
bool getEncodingPassthru()
get the encoding passthru status
Qore::True
const True
logical True
Definition: qc_qore.dox.h:98
Qore::HTTPClient::addDefaultHeaders
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
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::setErrorPassthru
bool setErrorPassthru(bool set=True)
set the error passthru status
Qore::Thread::Queue
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition: QC_Queue.dox.h:22
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::clearWarningQueue
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
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::getUsageInfo
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
Qore::HTTPClient::getEncoding
string getEncoding()
Returns the character encoding used for the object.
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::OutputStream
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:18
Qore::HTTPClient::setProxyURL
nothing setProxyURL(string url)
Sets a new proxy URL value for the next connection.
Qore::HTTPClient::setUserPassword
nothing setUserPassword()
Clears the username and password for the connection.
Qore::HTTPClient::setURL
setURL(string url)
Sets a new 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::getHTTPVersion
string getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
Qore::HTTPClient::getMaxRedirects
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
Qore::HTTPClient::getConnectionPath
*string getConnectionPath()
Returns the current connection path set in the URL.
Qore::HTTPClient::setConnectTimeout
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
Qore::HTTPClient::setNoDelay
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
Qore::HTTPClient::getErrorPassthru
bool getErrorPassthru()
get the error passthru status
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::clearStats
clearStats()
Clears performance statistics.
Qore::HTTPClient::getProxyURL
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
Qore::HTTPClient::clearProxyUserPassword
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
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::setTimeout
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
Qore::HTTPClient::clearUserPassword
nothing clearUserPassword()
Clears the username and password for the connection.
Qore::HTTPClient::getDefaultHeaders
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
Qore::HTTPClient::setProxySecure
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
Qore::HTTPClient::setHTTPVersion
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1....
Qore::Socket
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:124
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::setPersistent
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected
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::setProxyUserPassword
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
Qore::False
const False
logical False
Definition: qc_qore.dox.h:96
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::getHostHeaderValue
string getHostHeaderValue()
returns the Host header value for this object
Qore::HTTPClient::constructor
constructor(hash< auto > opts)
Creates the HTTPClient object based on the option parameter passed.
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::setUserPassword
nothing setUserPassword(string user, string pass)
Sets the username and password for the connection; call after HTTPClient::setURL()
Qore::HTTPClient::connect
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
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::setRedirectPassthru
bool setRedirectPassthru(bool set=True)
set the redirect passthru status
Qore::HTTPClient::copy
copy()
Copying objects of this class is not supported, an exception will be thrown.
Qore
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
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::isProxySecure
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
Qore::HTTPClient::getConnectTimeout
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
Qore::InputStream
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:19
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::getNoDelay
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)