Qore Programming Language Reference Manual  0.9.4.6
QC_HTTPClient.dox.h
1 
3 namespace Qore {
5 
159 class HTTPClient : public Socket {
160 
161 public:
163 
168 nothing clearProxyURL();
169 
170 public:
172 
180 
181 public:
183 
193 
194 public:
196 
204 
205 public:
207 
217 
218 public:
220 
234 nothing connect();
235 
236 public:
238 
298  constructor(hash<auto> opts);
299 
300 public:
302 
308 
309 public:
311 
313  copy();
314 
315 public:
317 
323 
324 public:
326 
331 nothing disconnect();
332 
333 public:
335 
389 *string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
390 
391 public:
393 
407 
408 public:
410 
421 
422 public:
424 
437 
438 public:
440 
450 string getDefaultPath();
451 
452 public:
454 
464 string getEncoding();
465 
466 public:
468 
484 
485 public:
487 
504 
505 public:
507 
517 string getHTTPVersion();
518 
519 public:
521 
534 
535 public:
537 
548 
549 public:
551 
561 bool getNoDelay();
562 
563 public:
565 
575 *string getProxyURL();
576 
577 public:
579 
594 
595 public:
597 
608 
609 public:
611 
621 *string getURL();
622 
623 public:
625 
646 hash<auto> getUsageInfo();
647 
648 public:
650 
698 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
699 
700 public:
702 
712 bool isConnected();
713 
714 public:
716 
727 
728 public:
730 
741 bool isSecure();
742 
743 public:
745 
797 *string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
798 
799 public:
801 
852 *string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
853 
854 public:
856 
908 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
909 
910 public:
912 
963 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
964 
965 public:
967 
1022 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);
1023 
1024 public:
1026 
1089 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);
1090 
1091 public:
1093 
1159 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1160 
1161 public:
1163 
1225 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1226 
1227 public:
1229 
1289 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1290 
1291 public:
1293 
1350 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1351 
1352 public:
1354 
1363  setAssumedEncoding(*string encoding);
1364 
1365 public:
1367 
1374 nothing setConnectTimeout(timeout timeout_ms = -1);
1375 
1376 public:
1378 
1387  setConnectionPath(*string uri_path);
1388 
1389 public:
1391 
1398 nothing setDefaultPath(*string path);
1399 
1400 public:
1402 
1409 nothing setEncoding(string encoding);
1410 
1411 public:
1413 
1428 bool setEncodingPassthru(bool set = True);
1429 
1430 public:
1432 
1449 bool setErrorPassthru(bool set = True);
1450 
1451 public:
1453 
1458 nothing setEventQueue();
1459 
1460 public:
1462 
1477 nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1478 
1479 public:
1481 
1490 nothing setHTTPVersion(string ver);
1491 
1492 public:
1494 
1503 nothing setMaxRedirects(softint mr = 0);
1504 
1505 public:
1507 
1524 int setNoDelay(softbool b = True);
1525 
1526 public:
1528 
1541 
1542 public:
1544 
1551 nothing setProxySecure(softbool b = True);
1552 
1553 public:
1555 
1562 nothing setProxyURL();
1563 
1564 public:
1566 
1578 nothing setProxyURL(string url);
1579 
1580 public:
1582 
1592 nothing setProxyUserPassword(string user, string pass);
1593 
1594 public:
1596 
1608 
1609 public:
1611 
1624 bool setRedirectPassthru(bool set = True);
1625 
1626 public:
1628 
1639 nothing setSecure(softbool secure = True);
1640 
1641 public:
1643 
1650 nothing setTimeout(timeout timeout_ms = 0);
1651 
1652 public:
1654 
1670  setURL(string url);
1671 
1672 public:
1674 
1684 nothing setUserPassword(string user, string pass);
1685 
1686 public:
1688 
1700 
1701 public:
1703 
1735 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1736 };
1737 }
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:159
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::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:17
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::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:123
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:18
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)