Qore Programming Language Reference Manual  0.9.14
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 }
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:163
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 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 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:136
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