Qore Programming Language Reference Manual 1.16.0
Loading...
Searching...
No Matches
QC_HTTPClient.dox.h
1
3namespace Qore {
5
200class HTTPClient : public Socket {
201
202public:
204
210nothing addDefaultHeaders(hash<auto> hdr);
211
212public:
214
220
221public:
223
231
232public:
234
244
245public:
247
255
256public:
258
268
269public:
271
290nothing connect();
291
292public:
294
392 constructor(hash<auto> opts);
393
394public:
396
402
403public:
405
408
409public:
411
417
418public:
420
425nothing disconnect();
426
427public:
429
483*string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
484
485public:
487
501
502public:
504
515
516public:
518
531
532public:
534
543hash<string,string> getDefaultHeaders();
544
545public:
547
558
559public:
561
571string getEncoding();
572
573public:
575
591
592public:
594
611
612public:
614
625
626public:
628
641
642public:
644
655
656public:
658
669
670public:
672
689
690public:
692
704*string getProxyURL();
705
706public:
708
723
724public:
726
742
743public:
745
760*string getSafeURL();
761
762public:
764
775
776public:
778
791*string getURL();
792
793public:
795
816hash<auto> getUsageInfo();
817
818public:
820
868hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
869
870public:
872
883
884public:
886
897
898public:
900
911bool isSecure();
912
913public:
915
967*string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
968
969public:
971
1022*string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
1023
1024public:
1026
1097hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1098
1099public:
1101
1154hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1155
1156public:
1158
1215nothing 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);
1216
1217public:
1219
1285nothing 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);
1286
1287public:
1289
1357nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1358
1359public:
1361
1425nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1426
1427public:
1429
1491nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1492
1493public:
1495
1554hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1555
1556public:
1558
1567 setAssumedEncoding(*string encoding);
1568
1569public:
1571
1578nothing setConnectTimeout(timeout timeout_ms = -1);
1579
1580public:
1582
1591 setConnectionPath(*string uri_path);
1592
1593public:
1595
1602nothing setDefaultPath(*string path);
1603
1604public:
1606
1613nothing setEncoding(string encoding);
1614
1615public:
1617
1632bool setEncodingPassthru(bool set = True);
1633
1634public:
1636
1653bool setErrorPassthru(bool set = True);
1654
1655public:
1657
1663
1664public:
1666
1681nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1682
1683public:
1685
1694nothing setHTTPVersion(string ver);
1695
1696public:
1698
1707nothing setMaxRedirects(softint mr = 0);
1708
1709public:
1711
1728int setNoDelay(softbool b = True);
1729
1730public:
1732
1745
1746public:
1748
1765bool setPreEncodedUrls(bool set = True);
1766
1767public:
1769
1776nothing setProxySecure(softbool b = True);
1777
1778public:
1780
1787nothing setProxyURL();
1788
1789public:
1791
1803nothing setProxyURL(string url);
1804
1805public:
1807
1817nothing setProxyUserPassword(string user, string pass);
1818
1819public:
1821
1833
1834public:
1836
1849bool setRedirectPassthru(bool set = True);
1850
1851public:
1853
1864nothing setSecure(softbool secure = True);
1865
1866public:
1868
1875nothing setTimeout(timeout timeout_ms = 0);
1876
1877public:
1879
1895 setURL(string url);
1896
1897public:
1899
1909nothing setUserPassword(string user, string pass);
1910
1911public:
1913
1925
1926public:
1928
1960nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1961
1962public:
1964
1969
1970public:
1972
2002AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
2003
2004public:
2006
2036AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
2037};
2038}
Abstract poll operation objects provide the polling interface for pollable objects.
Definition: QC_AbstractPollOperation.dox.h:6
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:200
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.
AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
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.
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...
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
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.
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
*string getSafeProxyURL()
Returns the current proxy URL without the password field.
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.
*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 ...
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...
AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
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 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...
clearStats()
Clears performance statistics.
bool getPreEncodedUrls()
get the pre-encoded URL flag
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.
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 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...
bool setPreEncodedUrls(bool set=True)
set the pre-encoded URL flag
string getEncoding()
Returns the character encoding used for the object.
nothing clearUserPassword()
Clears the username and password for the connection.
*string getURL()
Returns the current URL.
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
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 > getUsageInfo()
Returns performance statistics for the socket.
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 getSafeURL()
Returns the current URL without the password field.
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...
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 > head(string path, *hash< auto > headers, *reference< hash< auto > > info)
Sends an HTTP HEAD request and returns as hash of the headers received.
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
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...
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
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.
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 ...
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.
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)
*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...
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
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.
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.
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...
AbstractPollOperation startPollConnect()
Returns an AbstractPollOperation object to make a non-blocking HTTP connection.
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:152
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)
Qore namespace.
Definition: QC_AbstractSmartLock.dox.h:2