| Qore Programming Language Reference Manual 2.2.0

Loading...
Searching...
No Matches
QC_HTTPClient.dox.h
1
3 namespace Qore {
5
200 class HTTPClient : public Socket, public Serializable {
201
202 public:
204
210nothing addDefaultHeaders(hash<auto> hdr);
211
212 public:
214
227 clearPersistent();
228
229 public:
231
236nothing clearProxyURL();
237
238 public:
240
248nothing clearProxyUserPassword();
249
250 public:
252
261 clearStats();
262
263 public:
265
273nothing clearUserPassword();
274
275 public:
277
286nothing clearWarningQueue();
287
288 public:
290
309nothing connect();
310
311 public:
313
421 constructor(hash<auto> opts);
422
423 public:
425
430 constructor();
431
432 public:
434
436 copy();
437
438 public:
440
445 destructor();
446
447 public:
449
456nothing disconnect();
457
458 public:
460
514*string get(string path, *hash<auto> headers, *reference<hash<auto>> info);
515
516 public:
518
531 string getAssumedEncoding();
532
533 public:
535
546 int getConnectTimeout();
547
548 public:
550
562*string getConnectionPath();
563
564 public:
566
575 hash<string,string> getDefaultHeaders();
576
577 public:
579
589 string getDefaultPath();
590
591 public:
593
603 string getEncoding();
604
605 public:
607
622 bool getEncodingPassthru();
623
624 public:
626
642 bool getErrorPassthru();
643
644 public:
646
656 string getHTTPVersion();
657
658 public:
660
672 string getHostHeaderValue();
673
674 public:
676
683 hash<auto> getHttpConfig();
684
685 public:
687
697 int getMaxRedirects();
698
699 public:
701
711 bool getNoDelay();
712
713 public:
715
722*string getPassword();
723
724 public:
726
733 int getPersistentCount();
734
735 public:
737
753 bool getPreEncodedUrls();
754
755 public:
757
764*string getProxyPassword();
765
766 public:
768
780*string getProxyURL();
781
782 public:
784
791*string getProxyUsername();
792
793 public:
795
809 bool getRedirectPassthru();
810
811 public:
813
828*string getSafeProxyURL();
829
830 public:
832
847*string getSafeURL();
848
849 public:
851
861 int getTimeout();
862
863 public:
865
880*string getURL(int code = URL_NORMAL);
881
882 public:
884
910 hash<auto> getUsageInfo();
911
912 public:
914
921*string getUsername();
922
923 public:
925
973 hash<auto> head(string path, *hash<auto> headers, *reference<hash<auto>> info);
974
975 public:
977
987 bool isConnected();
988
989 public:
991
998 bool isPersistent();
999
1000 public:
1002
1012 bool isProxySecure();
1013
1014 public:
1016
1027 bool isSecure();
1028
1029 public:
1031
1083*string post(string path, string body, *hash<auto> headers, *reference<hash<auto>> info);
1084
1085 public:
1087
1138*string post(string path, *binary body, *hash<auto> headers, *reference<hash<auto>> info);
1139
1140 public:
1142
1213 hash<auto> send(string body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1214
1215 public:
1217
1274 hash<auto> send(*binary body, string method, *string path, *hash<auto> headers, softbool getbody = False, *reference<hash<auto>> info);
1275
1276 public:
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
1337 public:
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
1407 public:
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
1483 public:
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
1555 public:
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
1625 public:
1627
1690 hash<auto> sendWithSendCallback(code scb, string method, *string path, *hash<auto> headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1691
1692 public:
1694
1703 setAssumedEncoding(*string encoding);
1704
1705 public:
1707
1717nothing setConnectTimeout(timeout timeout_ms = -1);
1718
1719 public:
1721
1730 setConnectionPath(*string uri_path);
1731
1732 public:
1734
1741nothing setDefaultPath(*string path);
1742
1743 public:
1745
1752nothing setEncoding(string encoding);
1753
1754 public:
1756
1771 bool setEncodingPassthru(bool set = True);
1772
1773 public:
1775
1792 bool setErrorPassthru(bool set = True);
1793
1794 public:
1796
1801nothing setEventQueue();
1802
1803 public:
1805
1821nothing setEventQueue(Qore::Thread::Queue queue, auto arg, *bool with_data);
1822
1823 public:
1825
1834nothing setHTTPVersion(string ver);
1835
1836 public:
1838
1847nothing setMaxRedirects(softint mr = 0);
1848
1849 public:
1851
1874 int setNoDelay(softbool b = True);
1875
1876 public:
1878
1895 setPersistent();
1896
1897 public:
1899
1916 bool setPreEncodedUrls(bool set = True);
1917
1918 public:
1920
1927nothing setProxySecure(softbool b = True);
1928
1929 public:
1931
1938nothing setProxyURL();
1939
1940 public:
1942
1954nothing setProxyURL(string url);
1955
1956 public:
1958
1969nothing setProxyUserPassword(string user, string pass);
1970
1971 public:
1973
1985nothing setProxyUserPassword();
1986
1987 public:
1989
2002 bool setRedirectPassthru(bool set = True);
2003
2004 public:
2006
2017nothing setSecure(softbool secure = True);
2018
2019 public:
2021
2028nothing setTimeout(timeout timeout_ms = 0);
2029
2030 public:
2032
2048 setURL(string url);
2049
2050 public:
2052
2063nothing setUserPassword(string user, string pass);
2064
2065 public:
2067
2079nothing setUserPassword();
2080
2081 public:
2083
2124nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
2125
2126 public:
2128
2132 AbstractPollOperation startPollConnect();
2133
2134 public:
2136
2167 AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash<auto> headers);
2168
2169 public:
2171
2202 AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash<auto> headers);
2203};
2204
2209
2211 const UC_MASK_PASSWORD = UC_MASK_PASSWORD;
2213 const UC_PASSWORD = UC_PASSWORD;
2215 const UC_PATH = UC_PATH;
2217 const UC_TARGET = UC_TARGET;
2219 const UC_USERNAME = UC_USERNAME;
2221 const URL_NORMAL = URL_NORMAL;
2223}
Qore::AbstractPollOperation
Abstract poll operation objects provide the polling interface for pollable objects.
Definition QC_AbstractPollOperation.dox.h:6
Qore::HTTPClient
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition QC_HTTPClient.dox.h:200
Qore::HTTPClient::getHostHeaderValue
string getHostHeaderValue()
returns the Host header value for this object
Qore::HTTPClient::getEncodingPassthru
bool getEncodingPassthru()
get the encoding passthru status
Qore::HTTPClient::isProxySecure
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
Qore::HTTPClient::startPollSendRecv
AbstractPollOperation startPollSendRecv(string method, *string path, *binary body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
Qore::HTTPClient::getProxyUsername
*string getProxyUsername()
Returns any username set for the proxy connection, if any.
Qore::HTTPClient::setHTTPVersion
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are "1....
Qore::HTTPClient::setErrorPassthru
bool setErrorPassthru(bool set=True)
set the error passthru status
Qore::HTTPClient::constructor
constructor()
Creates the HTTPClient object.
Qore::HTTPClient::getConnectionPath
*string getConnectionPath()
Returns the current connection path set in the URL.
Qore::HTTPClient::setProxyURL
nothing setProxyURL(string url)
Sets a new proxy URL value for the next connection.
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::getDefaultPath
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
Qore::HTTPClient::setPersistent
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected
Qore::HTTPClient::getProxyURL
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
Qore::HTTPClient::getURL
*string getURL(int code=URL_NORMAL)
Returns the current URL.
Qore::HTTPClient::getNoDelay
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
Qore::HTTPClient::getPassword
*string getPassword()
Returns any password set for the connection.
Qore::HTTPClient::clearWarningQueue
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
Qore::HTTPClient::getHttpConfig
hash< auto > getHttpConfig()
Returns the configuration of the HTTP client.
Qore::HTTPClient::getPersistentCount
int getPersistentCount()
Returns the persistent connection count.
Qore::HTTPClient::getSafeProxyURL
*string getSafeProxyURL()
Returns the current proxy URL without the password field.
Qore::HTTPClient::getHTTPVersion
string getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
Qore::HTTPClient::setEncodingPassthru
bool setEncodingPassthru(bool set=True)
set the encoding passthru status
Qore::HTTPClient::clearPersistent
clearPersistent()
Decrements the persistent connection count and clears the persistent connection flag when it reaches ...
Qore::HTTPClient::isSecure
bool isSecure()
Returns True if the current connection is encrypted, False if not.
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::setConnectTimeout
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
Qore::HTTPClient::getAssumedEncoding
string getAssumedEncoding()
returns the assumed character encoding for messages from the HTTP server without any charset indicato...
Qore::HTTPClient::startPollSendRecv
AbstractPollOperation startPollSendRecv(string method, *string path, string body, *hash< auto > headers)
Returns an AbstractPollOperation object to send a message and receive the response.
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::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::HTTPClient::clearStats
clearStats()
Clears performance statistics.
Qore::HTTPClient::getProxyPassword
*string getProxyPassword()
Returns any password set for the proxy connection, if any.
Qore::HTTPClient::getPreEncodedUrls
bool getPreEncodedUrls()
get the pre-encoded URL flag
Qore::HTTPClient::getErrorPassthru
bool getErrorPassthru()
get the error passthru status
Qore::HTTPClient::connect
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
Qore::HTTPClient::getConnectTimeout
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
Qore::HTTPClient::setURL
setURL(string url)
Sets a new URL value for the next connection.
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::setDefaultPath
nothing setDefaultPath(*string path)
Sets the default path used by the object if no path is set in the URL.
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::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::setPreEncodedUrls
bool setPreEncodedUrls(bool set=True)
set the pre-encoded URL flag
Qore::HTTPClient::getUsername
*string getUsername()
Returns any username set for the connection.
Qore::HTTPClient::getEncoding
string getEncoding()
Returns the character encoding used for the object.
Qore::HTTPClient::clearUserPassword
nothing clearUserPassword()
Clears the username and password for the connection.
Qore::HTTPClient::isPersistent
bool isPersistent()
Returns True if the persistent flag is set.
Qore::HTTPClient::setConnectionPath
setConnectionPath(*string uri_path)
Overrides any connection path set in the URL.
Qore::HTTPClient::setUserPassword
nothing setUserPassword(string user, string pass)
Sets the username and password for the connection; call after HTTPClient::setURL()
Qore::HTTPClient::copy
copy()
Copying objects of this class is not supported, an exception will be thrown.
Qore::HTTPClient::getUsageInfo
hash< auto > getUsageInfo()
Returns performance statistics for the socket.
Qore::HTTPClient::constructor
constructor(hash< auto > opts)
Creates the HTTPClient object based on the option parameter passed.
Qore::HTTPClient::setUserPassword
nothing setUserPassword()
Clears the username and password for the connection.
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::getSafeURL
*string getSafeURL()
Returns the current URL without the password field.
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::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::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::addDefaultHeaders
nothing addDefaultHeaders(hash< auto > hdr)
Sets headers to send by default with every outgoing request.
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::clearProxyUserPassword
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
Qore::HTTPClient::getDefaultHeaders
hash< string, string > getDefaultHeaders()
Returns a hash of default headers to be sent with every outgoing request.
Qore::HTTPClient::clearProxyURL
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
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::isConnected
bool isConnected()
Returns True or False giving the current connection state.
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::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::setProxySecure
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
Qore::HTTPClient::setNoDelay
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
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::disconnect
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing)
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::setAssumedEncoding
setAssumedEncoding(*string encoding)
sets the assumed character encoding for messages from the HTTP server without any charset indicator
Qore::HTTPClient::setProxyURL
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
Qore::HTTPClient::setRedirectPassthru
bool setRedirectPassthru(bool set=True)
set the redirect passthru status
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::setProxyUserPassword
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
Qore::HTTPClient::setTimeout
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
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.
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::getMaxRedirects
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
Qore::HTTPClient::startPollConnect
AbstractPollOperation startPollConnect()
Returns an AbstractPollOperation object to make a non-blocking HTTP connection.
Qore::InputStream
This class defines an abstract interface for input streams.
Definition QC_InputStream.dox.h:19
Qore::OutputStream
This class defines an abstract interface for output streams.
Definition QC_OutputStream.dox.h:18
Qore::Serializable
The Serializable class can be used to mark a class as being serializable.
Definition QC_Serializable.dox.h:100
Qore::Socket
The Socket class allows Qore programs safe access to network sockets.
Definition QC_Socket.dox.h:172
Qore::Thread::Queue
Queue objects provide a blocking, thread-safe message-passing object to Qore programs
Definition QC_Queue.dox.h:22
Qore::True
const True
logical True
Definition qc_qore.dox.h:98
Qore::False
const False
logical False
Definition qc_qore.dox.h:96
Qore::UC_TARGET
const UC_TARGET
Return the target portion of the URL.
Definition QC_HTTPClient.dox.h:2217
Qore::UC_PASSWORD
const UC_PASSWORD
Return password (if any)
Definition QC_HTTPClient.dox.h:2213
Qore::URL_NORMAL
const URL_NORMAL
Return all info.
Definition QC_HTTPClient.dox.h:2221
Qore::UC_MASK_PASSWORD
const UC_MASK_PASSWORD
Mask any password returned.
Definition QC_HTTPClient.dox.h:2211
Qore::UC_PATH
const UC_PATH
Return the path (if any)
Definition QC_HTTPClient.dox.h:2215
Qore::UC_USERNAME
const UC_USERNAME
Return username (if any)
Definition QC_HTTPClient.dox.h:2219
Qore::hash
hash< auto > hash(object obj)
Returns a hash of an object's members.
Qore::binary
binary binary()
Always returns an empty binary object (of zero length)
Qore
main Qore-language namespace
Definition Pseudo_QC_All.dox.h:3