Qore Programming Language Reference Manual  1.0.8
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 
284 nothing connect();
285 
286 public:
288 
352  constructor(hash<auto> opts);
353 
354 public:
356 
361  constructor();
362 
363 public:
365 
367  copy();
368 
369 public:
371 
376  destructor();
377 
378 public:
380 
385 nothing disconnect();
386 
387 public:
389 
443 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
444 
445 public:
447 
460 string getAssumedEncoding();
461 
462 public:
464 
474 int getConnectTimeout();
475 
476 public:
478 
490 *string getConnectionPath();
491 
492 public:
494 
503 hash<string,string> getDefaultHeaders();
504 
505 public:
507 
517 string getDefaultPath();
518 
519 public:
521 
531 string getEncoding();
532 
533 public:
535 
550 bool getEncodingPassthru();
551 
552 public:
554 
570 bool getErrorPassthru();
571 
572 public:
574 
584 string getHTTPVersion();
585 
586 public:
588 
600 string getHostHeaderValue();
601 
602 public:
604 
614 int getMaxRedirects();
615 
616 public:
618 
628 bool getNoDelay();
629 
630 public:
632 
642 *string getProxyURL();
643 
644 public:
646 
660 bool getRedirectPassthru();
661 
662 public:
664 
674 int getTimeout();
675 
676 public:
678 
688 *string getURL();
689 
690 public:
692 
713 hash<auto> getUsageInfo();
714 
715 public:
717 
765 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
766 
767 public:
769 
779 bool isConnected();
780 
781 public:
783 
793 bool isProxySecure();
794 
795 public:
797 
808 bool isSecure();
809 
810 public:
812 
864 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
865 
866 public:
868 
919 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
920 
921 public:
923 
975 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
976 
977 public:
979 
1030 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1031 
1032 public:
1034 
1089 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);
1090 
1091 public:
1093 
1156 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);
1157 
1158 public:
1160 
1226 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1227 
1228 public:
1230 
1292 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1293 
1294 public:
1296 
1356 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1357 
1358 public:
1360 
1417 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1418 
1419 public:
1421 
1430  setAssumedEncoding(*string encoding);
1431 
1432 public:
1434 
1441 nothing setConnectTimeout(timeout timeout_ms = -1);
1442 
1443 public:
1445 
1454  setConnectionPath(*string uri_path);
1455 
1456 public:
1458 
1465 nothing setDefaultPath(*string path);
1466 
1467 public:
1469 
1476 nothing setEncoding(string encoding);
1477 
1478 public:
1480 
1495 bool setEncodingPassthru(bool set = True);
1496 
1497 public:
1499 
1516 bool setErrorPassthru(bool set = True);
1517 
1518 public:
1520 
1525 nothing setEventQueue();
1526 
1527 public:
1529 
1544 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1545 
1546 public:
1548 
1557 nothing setHTTPVersion(string ver);
1558 
1559 public:
1561 
1570 nothing setMaxRedirects(softint mr = 0);
1571 
1572 public:
1574 
1591 int setNoDelay(softbool b = True);
1592 
1593 public:
1595 
1607  setPersistent();
1608 
1609 public:
1611 
1618 nothing setProxySecure(softbool b = True);
1619 
1620 public:
1622 
1629 nothing setProxyURL();
1630 
1631 public:
1633 
1645 nothing setProxyURL(string url);
1646 
1647 public:
1649 
1659 nothing setProxyUserPassword(string user, string pass);
1660 
1661 public:
1663 
1674 nothing setProxyUserPassword();
1675 
1676 public:
1678 
1691 bool setRedirectPassthru(bool set = True);
1692 
1693 public:
1695 
1706 nothing setSecure(softbool secure = True);
1707 
1708 public:
1710 
1717 nothing setTimeout(timeout timeout_ms = 0);
1718 
1719 public:
1721 
1737  setURL(string url);
1738 
1739 public:
1741 
1751 nothing setUserPassword(string user, string pass);
1752 
1753 public:
1755 
1766 nothing setUserPassword();
1767 
1768 public:
1770 
1802 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1803 };
1804 }
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
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 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.
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:136
string getEncoding()
Returns the character encoding used for the object.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
nothing setMaxRedirects(softint mr=0)
Updates the setting for the max_redirects value for the object (maximum number of HTTP redirects that...
const True
logical True
Definition: qc_qore.dox.h:98
bool isSecure()
Returns True if the current connection is encrypted, False if not.
bool isConnected()
Returns True or False giving the current connection state.
bool setRedirectPassthru(bool set=True)
set the redirect passthru status
binary binary()
Always returns an empty binary object (of zero length)
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
int getTimeout()
Returns the default I/O timeout as an integer in milliseconds.
constructor()
Creates the HTTPClient object.
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...
string getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
const False
logical False
Definition: qc_qore.dox.h:96
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
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 setEncodingPassthru(bool set=True)
set the encoding passthru status
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
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.
string getAssumedEncoding()
returns the assumed character encoding for messages from the HTTP server without any charset indicato...
bool getRedirectPassthru()
get the redirect passthru status
*string getURL()
Returns the current URL.
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
setAssumedEncoding(*string encoding)
sets the assumed character encoding for messages from the HTTP server without any charset indicator ...
copy()
Copying objects of this class is not supported, an exception will be thrown.
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:199
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 ...
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:18
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
bool getEncodingPassthru()
get the encoding passthru status
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing) ...
nothing clearUserPassword()
Clears the username and password for the connection.
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...
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
string getHostHeaderValue()
returns the Host header value for this object
*string getConnectionPath()
Returns the current connection path set in the URL.
clearStats()
Clears performance statistics.
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
destructor()
Destroys the HTTPClient object and closes any open connections.
Queue objects provide a blocking, thread-safe message-passing object to Qore programs ...
Definition: QC_Queue.dox.h:22
bool setErrorPassthru(bool set=True)
set the error passthru status
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
nothing setEventQueue()
Clears any Queue object that may be set on the HTTPClient object so that I/O events are no longer cap...
*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...
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;...
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...
setURL(string url)
Sets a new URL value for the next connection.
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected ...
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:19
nothing setUserPassword()
Clears the username and password for the connection.
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
bool getErrorPassthru()
get the error passthru status
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1...