Qore Programming Language Reference Manual  0.8.13.5
 All Classes Namespaces Functions Variables Groups Pages
QC_HTTPClient.dox.h
1 namespace Qore {
4 
158 class HTTPClient : public Socket {
159 
160 public:
162 
167 nothing clearProxyURL();
168 
169 public:
171 
178 nothing clearProxyUserPassword();
179 
180 public:
182 
191  clearStats();
192 
193 public:
195 
202 nothing clearUserPassword();
203 
204 public:
206 
215 nothing clearWarningQueue();
216 
217 public:
219 
233 nothing connect();
234 
235 public:
237 
280  constructor(hash opts);
281 
282 public:
284 
289  constructor();
290 
291 public:
293 
295  copy();
296 
297 public:
299 
304  destructor();
305 
306 public:
308 
313 nothing disconnect();
314 
315 public:
317 
363 *string get(string path, *hash headers, *reference<hash> info);
364 
365 public:
367 
377 int getConnectTimeout();
378 
379 public:
381 
391 *string getConnectionPath();
392 
393 public:
395 
405 string getDefaultPath();
406 
407 public:
409 
419 string getEncoding();
420 
421 public:
423 
433 string getHTTPVersion();
434 
435 public:
437 
447 int getMaxRedirects();
448 
449 public:
451 
461 bool getNoDelay();
462 
463 public:
465 
475 *string getProxyURL();
476 
477 public:
479 
489 int getTimeout();
490 
491 public:
493 
503 *string getURL();
504 
505 public:
507 
529 
530 public:
532 
572 hash head(string path, *hash headers, *reference<hash> info);
573 
574 public:
576 
586 bool isConnected();
587 
588 public:
590 
600 bool isProxySecure();
601 
602 public:
604 
615 bool isSecure();
616 
617 public:
619 
663 *string post(string path, string body, *hash headers, *reference<hash> info);
664 
665 public:
667 
710 *string post(string path, *binary body, *hash headers, *reference<hash> info);
711 
712 public:
714 
758 hash send(string body, string method, *string path, *hash headers, softbool getbody = False, *reference<hash> info);
759 
760 public:
762 
805 hash send(*binary body, string method, *string path, *hash headers, softbool getbody = False, *reference<hash> info);
806 
807 public:
809 
853 nothing send(Qore::OutputStream os, *data body, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info, *code rcb);
854 
855 public:
857 
909 nothing sendChunked(Qore::OutputStream os, Qore::InputStream is, string method, int max_chunk_size = 4096, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info, *code rcb, *code tcb);
910 
911 public:
913 
970 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
971 
972 public:
974 
1027 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1028 
1029 public:
1031 
1082 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1083 
1084 public:
1086 
1135 hash sendWithSendCallback(code scb, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1136 
1137 public:
1139 
1146 nothing setConnectTimeout(timeout timeout_ms = -1);
1147 
1148 public:
1150 
1157 nothing setDefaultPath(*string path);
1158 
1159 public:
1161 
1168 nothing setEncoding(string encoding);
1169 
1170 public:
1172 
1177 nothing setEventQueue();
1178 
1179 public:
1181 
1192 nothing setEventQueue(Qore::Thread::Queue queue);
1193 
1194 public:
1196 
1205 nothing setHTTPVersion(string ver);
1206 
1207 public:
1209 
1218 nothing setMaxRedirects(softint mr = 0);
1219 
1220 public:
1222 
1239 int setNoDelay(softbool b = True);
1240 
1241 public:
1243 
1255  setPersistent();
1256 
1257 public:
1259 
1266 nothing setProxySecure(softbool b = True);
1267 
1268 public:
1270 
1277 nothing setProxyURL();
1278 
1279 public:
1281 
1293 nothing setProxyURL(string url);
1294 
1295 public:
1297 
1307 nothing setProxyUserPassword(string user, string pass);
1308 
1309 public:
1311 
1322 nothing setProxyUserPassword();
1323 
1324 public:
1326 
1337 nothing setSecure(softbool secure = True);
1338 
1339 public:
1341 
1348 nothing setTimeout(timeout timeout_ms = 0);
1349 
1350 public:
1352 
1368  setURL(string url);
1369 
1370 public:
1372 
1382 nothing setUserPassword(string user, string pass);
1383 
1384 public:
1386 
1397 nothing setUserPassword();
1398 
1399 public:
1401 
1433 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1434 };
1435 };
hash getUsageInfo()
Returns performance statistics for the socket.
bool getNoDelay()
Returns the TCP_NODELAY setting for the HTTPClient object.
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 setEncoding(string encoding)
Sets the string encoding for the object; any strings deserialized with this object will be tagged wit...
hash sendWithSendCallback(code scb, string method, *string path, *hash 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 ...
nothing setDefaultPath(*string path)
Sets the default path used by the object if no path is set in the URL.
The Socket class allows Qore programs safe access to network sockets.
Definition: QC_Socket.dox.h:122
string getEncoding()
Returns the character encoding used for the object.
nothing clearWarningQueue()
Removes any warning Queue object from the Socket.
nothing setMaxRedirects(softint mr=0)
Updates the setting for the max_redirects value for the object (maximum number of HTTP redirects that...
const True
logical True
Definition: qc_qore.dox.h:94
hash send(string body, string method, *string path, *hash headers, softbool getbody=False, *reference< hash > info)
Sends an HTTP request with the specified method and optional message body and returns headers and any...
bool isSecure()
Returns True if the current connection is encrypted, False if not.
bool isConnected()
Returns True or False giving the current connection state.
binary binary()
Always returns an empty binary object (of zero length)
nothing setTimeout(timeout timeout_ms=0)
Sets the default I/O timeout value in milliseconds.
*string post(string path, string body, *hash headers, *reference< hash > info)
Sends an HTTP POST request with a message body and returns the message body received as a string or N...
int getTimeout()
Returns the default I/O timeout as an integer in milliseconds.
constructor()
Creates the HTTPClient object.
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 getHTTPVersion()
Returns the HTTP protocol version string used in outgoing messages.
const False
logical False
Definition: qc_qore.dox.h:92
nothing setProxySecure(softbool b=True)
Sets the SSL/TLS flag for the next connection to the proxy.
nothing clearProxyUserPassword()
Clears the username and password for the next proxy connection.
nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash > info)
Sends an HTTP request with the specified method and optional message body; headers and any body recei...
nothing setProxyURL()
Clears the new proxy URL value for the next connection.
nothing setProxyUserPassword()
Clears the username and password for the next proxy connection.
hash head(string path, *hash headers, *reference< hash > info)
Sends an HTTP HEAD request and returns as hash of the headers received.
*string getURL()
Returns the current URL.
copy()
Copying objects of this class is not supported, an exception will be thrown.
The HTTPClient class can be used to communicate with HTTP servers with and without TLS/SSL encryption...
Definition: QC_HTTPClient.dox.h:158
This class defines an abstract interface for output streams.
Definition: QC_OutputStream.dox.h:12
nothing connect()
Connects to the remote socket; SSL/TLS negotiation is performed if required.
nothing clearProxyURL()
Clears the new proxy URL value for the next connection.
nothing disconnect()
Disconnects from the remote socket if a connection is established (otherwise does nothing) ...
nothing clearUserPassword()
Clears the username and password for the connection.
nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash 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;...
nothing setConnectTimeout(timeout timeout_ms=-1)
Sets the connect timeout in milliseconds.
*string getConnectionPath()
Returns the current connection path set in the URL.
clearStats()
Clears performance statistics.
nothing sendChunked(Qore::OutputStream os, Qore::InputStream is, string method, int max_chunk_size=4096, *string path, *hash headers, timeout timeout_ms=0, softbool getbody=False, *reference< hash > info, *code rcb, *code tcb)
Sends a chunked HTTP request with the specified method and message body; headers are returned through...
int getConnectTimeout()
Returns the connect timeout as an integer in milliseconds.
bool isProxySecure()
Returns the SSL/TLS flag for the next proxy connection.
destructor()
Destroys the HTTPClient object and closes any open connections.
Queue objects provide a blocking, thread-safe message-passing object to Qore programs ...
Definition: QC_Queue.dox.h:15
int getMaxRedirects()
Returns the current max_redirects value for the object (the maximum number of HTTP redirects that wil...
nothing setEventQueue()
Clears any Queue object that may be set on the HTTPClient object so that I/O events are no longer cap...
setURL(string url)
Sets a new URL value for the next connection.
setPersistent()
temporarily disables implicit reconnections; must be called when the server is already connected ...
string getDefaultPath()
Returns the default path used by the object if no path is set in the URL.
This class defines an abstract interface for input streams.
Definition: QC_InputStream.dox.h:12
nothing setUserPassword()
Clears the username and password for the connection.
hash hash(object obj)
Returns a hash of an object&#39;s members.
*string getProxyURL()
Returns the current proxy URL as a string or NOTHING if no proxy URL is set.
int setNoDelay(softbool b=True)
Sets the TCP_NODELAY setting for the object.
nothing setHTTPVersion(string ver)
Sets the HTTP protocol version string for headers in outgoing messages, allowed values are &quot;1...