Qore Programming Language Reference Manual 2.0.0
Loading...
Searching...
No Matches
QC_HTTPClient.dox.h
1
3namespace Qore {
5
200class HTTPClient : public Socket, public Serializable {
201
202public:
204
211
212public:
214
228
229public:
231
237
238public:
240
249
250public:
252
262
263public:
265
274
275public:
277
287
288public:
290
309nothing connect();
310
311public:
313
422
423public:
425
431
432public:
434
437
438public:
440
446
447public:
449
456nothing disconnect();
457
458public:
460
514*string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
515
516public:
518
532
533public:
535
547
548public:
550
563
564public:
566
576
577public:
579
590
591public:
593
603string getEncoding();
604
605public:
607
623
624public:
626
643
644public:
646
657
658public:
660
673
674public:
676
684
685public:
687
698
699public:
701
712
713public:
715
722*string getPassword();
723
724public:
726
734
735public:
737
754
755public:
757
765
766public:
768
780*string getProxyURL();
781
782public:
784
792
793public:
795
810
811public:
813
829
830public:
832
847*string getSafeURL();
848
849public:
851
862
863public:
865
880*string getURL(int code = URL_NORMAL);
881
882public:
884
911
912public:
914
921*string getUsername();
922
923public:
925
973hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
974
975public:
977
988
989public:
991
999
1000public:
1002
1013
1014public:
1016
1028
1029public:
1031
1083*string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
1084
1085public:
1087
1138*string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
1139
1140public:
1142
1213hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1214
1215public:
1217
1274hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1275
1276public:
1278
1335nothing 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);
1336
1337public:
1339
1405nothing 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);
1406
1407public:
1409
1481nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1482
1483public:
1485
1553nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1554
1555public:
1557
1623nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash<auto>> info);
1624
1625public:
1627
1690hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1691
1692public:
1694
1703 setAssumedEncoding(*string encoding);
1704
1705public:
1707
1717nothing setConnectTimeout(timeout timeout_ms = -1);
1718
1719public:
1721
1730 setConnectionPath(*string uri_path);
1731
1732public:
1734
1741nothing setDefaultPath(*string path);
1742
1743public:
1745
1752nothing setEncoding(string encoding);
1753
1754public:
1756
1771bool setEncodingPassthru(bool set = True);
1772
1773public:
1775
1792bool setErrorPassthru(bool set = True);
1793
1794public:
1796
1802
1803public:
1805
1821nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1822
1823public:
1825
1834nothing setHTTPVersion(string ver);
1835
1836public:
1838
1847nothing setMaxRedirects(softint mr = 0);
1848
1849public:
1851
1874int setNoDelay(softbool b = True);
1875
1876public:
1878
1896
1897public:
1899
1916bool setPreEncodedUrls(bool set = True);
1917
1918public:
1920
1927nothing setProxySecure(softbool b = True);
1928
1929public:
1931
1938nothing setProxyURL();
1939
1940public:
1942
1954nothing setProxyURL(string url);
1955
1956public:
1958
1969nothing setProxyUserPassword(string user, string pass);
1970
1971public:
1973
1986
1987public:
1989
2002bool setRedirectPassthru(bool set = True);
2003
2004public:
2006
2017nothing setSecure(softbool secure = True);
2018
2019public:
2021
2028nothing setTimeout(timeout timeout_ms = 0);
2029
2030public:
2032
2048 setURL(string url);
2049
2050public:
2052
2063nothing setUserPassword(string user, string pass);
2064
2065public:
2067
2080
2081public:
2083
2124nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
2125
2126public:
2128
2133
2134public:
2136
2167AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
2168
2169public:
2171
2202AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
2203};
2209
2223}
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.
*string getProxyUsername()
Returns any username set for the proxy connection, if any.
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.
*string getURL(int code=URL_NORMAL)
Returns the current URL.
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
*string getPassword()
Returns any password set for the connection.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
hash< auto > getHttpConfig()
Returns the configuration of the HTTP client.
int getPersistentCount()
Returns the persistent connection count.
*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
clearPersistent()
Decrements the persistent connection count and clears the persistent connection flag when it reaches ...
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.
*string getProxyPassword()
Returns any password set for the proxy connection, if any.
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 getUsername()
Returns any username set for the connection.
string getEncoding()
Returns the character encoding used for the object.
nothing clearUserPassword()
Clears the username and password for the connection.
bool isPersistent()
Returns True if the persistent flag is set.
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 Serializable class can be used to mark a class as being serializable.
Definition QC_Serializable.dox.h:100
The Socket class allows Qore programs safe access to network sockets.
Definition QC_Socket.dox.h:172
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
const UC_TARGET
Return the target portion of the URL.
Definition QC_HTTPClient.dox.h:2217
const UC_PASSWORD
Return password (if any)
Definition QC_HTTPClient.dox.h:2213
const URL_NORMAL
Return all info.
Definition QC_HTTPClient.dox.h:2221
const UC_MASK_PASSWORD
Mask any password returned.
Definition QC_HTTPClient.dox.h:2211
const UC_PATH
Return the path (if any)
Definition QC_HTTPClient.dox.h:2215
const UC_USERNAME
Return username (if any)
Definition QC_HTTPClient.dox.h:2219
hash< auto > hash()
Always returns the same hash passed.
binary binary()
Always returns an empty binary object (of zero length)
main Qore-language namespace
Definition Pseudo_QC_All.dox.h:3