Qore Programming Language Reference Manual  0.9.13
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 
193 nothing clearProxyUserPassword();
194 
195 public:
197 
206  clearStats();
207 
208 public:
210 
217 nothing clearUserPassword();
218 
219 public:
221 
230 nothing clearWarningQueue();
231 
232 public:
234 
248 nothing connect();
249 
250 public:
252 
315  constructor(hash<auto> opts);
316 
317 public:
319 
324  constructor();
325 
326 public:
328 
330  copy();
331 
332 public:
334 
339  destructor();
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 
423 string getAssumedEncoding();
424 
425 public:
427 
437 int getConnectTimeout();
438 
439 public:
441 
453 *string getConnectionPath();
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 
513 bool getEncodingPassthru();
514 
515 public:
517 
533 bool getErrorPassthru();
534 
535 public:
537 
547 string getHTTPVersion();
548 
549 public:
551 
563 string getHostHeaderValue();
564 
565 public:
567 
577 int getMaxRedirects();
578 
579 public:
581 
591 bool getNoDelay();
592 
593 public:
595 
605 *string getProxyURL();
606 
607 public:
609 
623 bool getRedirectPassthru();
624 
625 public:
627 
637 int getTimeout();
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 
756 bool isProxySecure();
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 
1570  setPersistent();
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 
1637 nothing setProxyUserPassword();
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 
1729 nothing setUserPassword();
1730 
1731 public:
1733 
1765 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1766 };
1767 }
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:163
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...