Qore Programming Language Reference Manual 1.12.4
Loading...
Searching...
No Matches
QC_HTTPClient.dox.h
1
3namespace Qore {
5
199class HTTPClient : public Socket {
200
201public:
203
209nothing addDefaultHeaders(hash<auto> hdr);
210
211public:
213
219
220public:
222
230
231public:
233
243
244public:
246
254
255public:
257
267
268public:
270
289nothing connect();
290
291public:
293
391 constructor(hash<auto> opts);
392
393public:
395
401
402public:
404
407
408public:
410
416
417public:
419
424nothing disconnect();
425
426public:
428
482*string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
483
484public:
486
500
501public:
503
514
515public:
517
530
531public:
533
542hash<string,string> getDefaultHeaders();
543
544public:
546
557
558public:
560
570string getEncoding();
571
572public:
574
590
591public:
593
610
611public:
613
624
625public:
627
640
641public:
643
654
655public:
657
668
669public:
671
688
689public:
691
703*string getProxyURL();
704
705public:
707
722
723public:
725
741
742public:
744
759*string getSafeURL();
760
761public:
763
774
775public:
777
790*string getURL();
791
792public:
794
815hash<auto> getUsageInfo();
816
817public:
819
867hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
868
869public:
871
882
883public:
885
896
897public:
899
910bool isSecure();
911
912public:
914
966*string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
967
968public:
970
1021*string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
1022
1023public:
1025
1096hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1097
1098public:
1100
1153hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1154
1155public:
1157
1214nothing 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);
1215
1216public:
1218
1284nothing 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);
1285
1286public:
1288
1356nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1357
1358public:
1360
1424nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1425
1426public:
1428
1490nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1491
1492public:
1494
1553hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1554
1555public:
1557
1566 setAssumedEncoding(*string encoding);
1567
1568public:
1570
1577nothing setConnectTimeout(timeout timeout_ms = -1);
1578
1579public:
1581
1590 setConnectionPath(*string uri_path);
1591
1592public:
1594
1601nothing setDefaultPath(*string path);
1602
1603public:
1605
1612nothing setEncoding(string encoding);
1613
1614public:
1616
1631bool setEncodingPassthru(bool set = True);
1632
1633public:
1635
1652bool setErrorPassthru(bool set = True);
1653
1654public:
1656
1662
1663public:
1665
1680nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1681
1682public:
1684
1693nothing setHTTPVersion(string ver);
1694
1695public:
1697
1706nothing setMaxRedirects(softint mr = 0);
1707
1708public:
1710
1727int setNoDelay(softbool b = True);
1728
1729public:
1731
1744
1745public:
1747
1764bool setPreEncodedUrls(bool set = True);
1765
1766public:
1768
1775nothing setProxySecure(softbool b = True);
1776
1777public:
1779
1786nothing setProxyURL();
1787
1788public:
1790
1802nothing setProxyURL(string url);
1803
1804public:
1806
1816nothing setProxyUserPassword(string user, string pass);
1817
1818public:
1820
1832
1833public:
1835
1848bool setRedirectPassthru(bool set = True);
1849
1850public:
1852
1863nothing setSecure(softbool secure = True);
1864
1865public:
1867
1874nothing setTimeout(timeout timeout_ms = 0);
1875
1876public:
1878
1894 setURL(string url);
1895
1896public:
1898
1908nothing setUserPassword(string user, string pass);
1909
1910public:
1912
1924
1925public:
1927
1959nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1960
1961public:
1963
1968
1969public:
1971
2001AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
2002
2003public:
2005
2035AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
2036};
2037}
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:199
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)
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3