Qore Programming Language Reference Manual  0.8.13
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 
806 hash send(*binary body, string method, *string path, *hash headers, softbool getbody = False, *reference<hash> info);
807 
808 public:
810 
854 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);
855 
856 public:
858 
910 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);
911 
912 public:
914 
971 nothing sendWithCallbacks(code scb, code rcb, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
972 
973 public:
975 
1029 nothing sendWithRecvCallback(code rcb, string body, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1030 
1031 public:
1033 
1085 nothing sendWithRecvCallback(code rcb, *binary body, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1086 
1087 public:
1089 
1139 hash sendWithSendCallback(code scb, string method, *string path, *hash headers, timeout timeout_ms = 0, softbool getbody = False, *reference<hash> info);
1140 
1141 public:
1143 
1150 nothing setConnectTimeout(timeout timeout_ms = -1);
1151 
1152 public:
1154 
1161 nothing setDefaultPath(*string path);
1162 
1163 public:
1165 
1172 nothing setEncoding(string encoding);
1173 
1174 public:
1176 
1181 nothing setEventQueue();
1182 
1183 public:
1185 
1196 nothing setEventQueue(Qore::Thread::Queue queue);
1197 
1198 public:
1200 
1209 nothing setHTTPVersion(string ver);
1210 
1211 public:
1213 
1222 nothing setMaxRedirects(softint mr = 0);
1223 
1224 public:
1226 
1243 int setNoDelay(softbool b = True);
1244 
1245 public:
1247 
1259  setPersistent();
1260 
1261 public:
1263 
1270 nothing setProxySecure(softbool b = True);
1271 
1272 public:
1274 
1281 nothing setProxyURL();
1282 
1283 public:
1285 
1297 nothing setProxyURL(string url);
1298 
1299 public:
1301 
1311 nothing setProxyUserPassword(string user, string pass);
1312 
1313 public:
1315 
1326 nothing setProxyUserPassword();
1327 
1328 public:
1330 
1341 nothing setSecure(softbool secure = True);
1342 
1343 public:
1345 
1352 nothing setTimeout(timeout timeout_ms = 0);
1353 
1354 public:
1356 
1372  setURL(string url);
1373 
1374 public:
1376 
1386 nothing setUserPassword(string user, string pass);
1387 
1388 public:
1390 
1401 nothing setUserPassword();
1402 
1403 public:
1405 
1437 nothing setWarningQueue(int warning_ms, int warning_bs, Queue queue, auto arg, timeout min_ms = 1s);
1438 };
1439 };
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 ...
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:2
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 "1...