Qore DataProvider Module Reference  2.5
QoreStringOrNothingDataType.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
26 namespace DataProvider {
29 
30 public:
32  constructor(*hash<auto> options, *hash<auto> tags) ;
33 
34 };
35 };
*hash< auto > tags
type tags
Definition: AbstractDataProviderType.qc.dox.h:203
hash< auto > options
type options
Definition: AbstractDataProviderType.qc.dox.h:200
describes a data type based on a string tyoe with a target encoding option
Definition: QoreStringDataTypeBase.qc.dox.h:36
describes a data type based on *string with a target encoding
Definition: QoreStringOrNothingDataType.qc.dox.h:28
constructor(*hash< auto > options, *hash< auto > tags)
creates the object with the given options
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27
oxyCompactList}\small\item\em Returns the {\ttfamily TCP\+\_\+\+NODELAY} setting for the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a3018d4114a87d90d914a0ed62e924e83}{get\+Proxy\+URL}} () \begin{DoxyCompactList}\small\item\em Returns the current proxy URL as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no proxy URL is set. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae0c812e5462014718091864a8d9ad07c}{get\+Redirect\+Passthru}} () \begin{DoxyCompactList}\small\item\em get the redirect passthru status \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a4c1c05e984dd44879c031f279e41c0a4}{get\+Safe\+Proxy\+URL}} () \begin{DoxyCompactList}\small\item\em Returns the current proxy URL without the password field. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_abae73dc4d3029d572a73e851251b06d6}{get\+Safe\+URL}} () \begin{DoxyCompactList}\small\item\em Returns the current URL without the password field. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ad8dea5c7fcbfbcdc3408f2d62922f3b1}{get\+Timeout}} () \begin{DoxyCompactList}\small\item\em Returns the default I/O timeout as an integer in milliseconds. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}{get\+URL}} () \begin{DoxyCompactList}\small\item\em Returns the current URL. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae98cfa16a0a9d4120e839f924d297d88}{get\+Usage\+Info}} () \begin{DoxyCompactList}\small\item\em Returns performance statistics for the socket. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aa69855f942fa531e159115ec5635519a}{head}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP {\ttfamily HEAD} request and returns as hash of the headers received. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_adbee3f312158d29d873527085eb48bea}{is\+Connected}} () \begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} giving the current connection state. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a04c2df5e6fca680874e388a093fa136a}{is\+Proxy\+Secure}} () \begin{DoxyCompactList}\small\item\em Returns the SSL/\+TLS flag for the next proxy connection. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5654958c7d5ca1106b092f85230a78f1}{is\+Secure}} () \begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the current connection is encrypted, \mbox{\hyperlink{basic_data_types_False}{False}} if not. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ac3e1328f5f008a181ad066e5a3a73229}{post}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP {\ttfamily POST} request with a message body and returns the message body received as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no message body is received. \end{DoxyCompactList}\item \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a823277eb390140f90f6382df3806dbf3}{post}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP {\ttfamily POST} request with a message body and returns the message body received as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no message body is received. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6b1663b61eb0c6a992a077a8c0d7943b}{send}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9899a18889d4099408c6939204e4d84f}{send}} (\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}} os, \+\_\+\+\_\+7\+\_\+ data body, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info, \+\_\+\+\_\+7\+\_\+ code rcb) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and optional message body; headers are returned through an optional receive callback and any body received is written to the \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a2b7084887db1c7b65744504feae95727}{send\+Chunked}} (\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}} os, \mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}} is, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} max\+\_\+chunk\+\_\+size=4096, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info, \+\_\+\+\_\+7\+\_\+ code rcb, \+\_\+\+\_\+7\+\_\+ code tcb) \begin{DoxyCompactList}\small\item\em Sends a chunked HTTP request with the specified method and message body; headers are returned through an optional receive callback and any body received is written to the \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9f59809a0a95796b7533b32cf614f527}{send\+With\+Callbacks}} (code scb, code rcb, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and chunked message body as given by a send callback; headers and any body received are returned through a receive callback. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a38aeb117b3923c90cf6a1a6e6e05b239}{send\+With\+Recv\+Callback}} (code rcb, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} body, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and optional message body; headers and any body received are returned through a receive callback. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a44d799ef24e73483c2d8816786d3dedd}{send\+With\+Recv\+Callback}} (code rcb, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} body, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and optional message body; headers and any body received are returned through a receive callback. \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aca21bac933b892a3cb27e77a50d9461a}{send\+With\+Send\+Callback}} (code scb, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} method, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ headers, timeout timeout\+\_\+ms=0, softbool getbody=\mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}} $>$ info) \begin{DoxyCompactList}\small\item\em Sends an HTTP request with the specified method and chunked message body as given by a send callback and returns headers and any body received as a response in a hash format. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aee4d57e5a86611578ef85c7cd2246092}{set\+Assumed\+Encoding}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding) \begin{DoxyCompactList}\small\item\em sets the assumed character encoding for messages from the HTTP server without any charset indicator \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a59c32a1cb1c23f5616a57c7b349521ef}{set\+Connect\+Timeout}} (timeout timeout\+\_\+ms=-\/1) \begin{DoxyCompactList}\small\item\em Sets the connect timeout in milliseconds. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9f2e9160de50ea228613df0f4ddc4eac}{set\+Connection\+Path}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} uri\+\_\+path) \begin{DoxyCompactList}\small\item\em Overrides any connection path set in the URL. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a7d57e49bdde9c6fa2d67013f3fb0a4c8}{set\+Default\+Path}} (\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} path) \begin{DoxyCompactList}\small\item\em Sets the default path used by the object if no path is set in the URL. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79ec21def4e2015d6da8b2a5d71e9b0e}{set\+Encoding}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding) \begin{DoxyCompactList}\small\item\em Sets the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a50b0c1fe246fe6f0d2a61bcf7f304cac}{set\+Encoding\+Passthru}} (bool set=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em set the encoding passthru status \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a178a903d388dbf76e78df59c3fc8cfc8}{set\+Error\+Passthru}} (bool set=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em set the error passthru status \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_af48e59604f6e7da844c79ac958b45f6a}{set\+Event\+Queue}} () \begin{DoxyCompactList}\small\item\em Clears any Queue object that may be set on the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object so that \mbox{\hyperlink{event_handling}{I/O events}} are no longer captured on the object. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ab882b74d8f3447c4f02d7cbb4902783b}{set\+Event\+Queue}} (\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg, \+\_\+\+\_\+7\+\_\+ bool with\+\_\+data) \begin{DoxyCompactList}\small\item\em Sets a Queue object to receive \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} and \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} events. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a123efcd92e5d648856435f3fa445d620}{set\+HTTPVersion}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} ver) \begin{DoxyCompactList}\small\item\em Sets the HTTP protocol version string for headers in outgoing messages, allowed values are {\ttfamily \char`\"{}1.\+0\char`\"{}} and "{}1.\+1"{}. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aea1c09e972256088465cacc56019906e}{set\+Max\+Redirects}} (softint mr=0) \begin{DoxyCompactList}\small\item\em Updates the setting for the {\ttfamily max\+\_\+redirects} value for the object (maximum number of HTTP redirects that will be processed before an exception is raised) \end{DoxyCompactList}\item \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae6d797291f0f87d5243e40d2f8ea2bb7}{set\+No\+Delay}} (softbool b=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em Sets the {\ttfamily TCP\+\_\+\+NODELAY} setting for the object. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a2e3bd5ea66d056b0a3f69b4d0e86964e}{set\+Persistent}} () \begin{DoxyCompactList}\small\item\em temporarily disables implicit reconnections; must be called when the server is already connected \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae58ff38024846050d5be3f6b36952c90}{set\+Proxy\+Secure}} (softbool b=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em Sets the SSL/\+TLS flag for the next connection to the proxy. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{set\+Proxy\+URL}} () \begin{DoxyCompactList}\small\item\em Clears the new proxy URL value for the next connection. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a27075d22526b650fdee997932cc1b658}{set\+Proxy\+URL}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} url) \begin{DoxyCompactList}\small\item\em Sets a new proxy URL value for the next connection. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_afb6865d4b0d09a03f8688a1acbe5b320}{set\+Proxy\+User\+Password}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} user, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass) \begin{DoxyCompactList}\small\item\em Sets the username and password for the connection to the proxy; call after \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_af4bccc6d03ff65bcd7e0a54c7b92e602}{set\+Proxy\+User\+Password}} () \begin{DoxyCompactList}\small\item\em Clears the username and password for the next proxy connection. \end{DoxyCompactList}\item bool \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef3874b2cf110ccc2e15ce0f79071962}{set\+Redirect\+Passthru}} (bool set=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em set the redirect passthru status \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5d0b8c0b6fe386efb42367d81cc20e51}{set\+Secure}} (softbool secure=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}) \begin{DoxyCompactList}\small\item\em Sets the object to make a secure SSL/\+TLS connection on the next connect if the passed argument is \mbox{\hyperlink{basic_data_types_True}{True}}, or an unencrypted cleartext connection if it is \mbox{\hyperlink{basic_data_types_False}{False}}. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_af55851848983f0c17a0ee2d217f6c198}{set\+Timeout}} (timeout timeout\+\_\+ms=0) \begin{DoxyCompactList}\small\item\em Sets the default I/O timeout value in milliseconds. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{set\+URL}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} url) \begin{DoxyCompactList}\small\item\em Sets a new URL value for the next connection. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aa02efa9f178f55a45da68a84bd824c71}{set\+User\+Password}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} user, \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass) \begin{DoxyCompactList}\small\item\em Sets the username and password for the connection; call after \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ab612d8a6bec649e1252515b2e78d2150}{set\+User\+Password}} () \begin{DoxyCompactList}\small\item\em Clears the username and password for the connection. \end{DoxyCompactList}\item nothing \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{set\+Warning\+Queue}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} warning\+\_\+ms, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} warning\+\_\+bs, Queue queue, auto arg, timeout min\+\_\+ms=1s) \begin{DoxyCompactList}\small\item\em Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive socket warnings. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection*{Additional Inherited Members} \doxysubsection{Detailed Description} The \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} class can be used to communicate with HTTP servers with and without TLS/\+SSL encryption. \begin{DoxyParagraph}{Restrictions\+:} \mbox{\hyperlink{group__parse__options_ga20400e83c6271a294a48b15a8f952efa}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+NETWORK}} \end{DoxyParagraph} The \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} class can be used to communicate with HTTP servers using the HTTP or HTTPS (HTTP using an SSL/\+TLS encrypted connection) protocol. By default {\ttfamily \char`\"{}\+Connection\+: Keep-\/\+Alive\char`\"{}} is always sent regardless of the HTTP protocol level set for the object, however if a server response contains {\ttfamily \char`\"{}\+Connection\+: close\char`\"{}}, the connection will be closed as soon as the full response (including any message body if present) has been read. HTTP redirect responses are supported and can be limited with the {\ttfamily max\+\_\+redirects} constructor hash key or by using the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aea1c09e972256088465cacc56019906e}{HTTPClient\+::set\+Max\+Redirects()}} method. The default maximum number of redirects allowed is 5. HTTP basic authentication is supported; set the username and password in the URL (ex\+: {\ttfamily \char`\"{}http\+://username\+:password@host\+:port/path\char`\"{}}). To change the URL from the one set by the constructor, call \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}}. HTTP proxies and basic proxy authentication are supported by setting the proxy constructor hash key to the proxy URL (with a proxy username and password if required) or by calling the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} method. Objects of this class are thread-\/safe and support serializing multiple simultaneous requests from many threads. If a request is in progress and another thread attempts to make a request at the same time, the second thread will block until the first is complete. Therefore the total amount of time a thread could wait for a response in a multi-\/threaded context could be greater than the timeout value (which applies to the maximum time a single internal \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action can take). This class understands and automatically decodes {\ttfamily \char`\"{}deflate\char`\"{}}, {\ttfamily \char`\"{}gzip\char`\"{}}, and {\ttfamily \char`\"{}bzip2\char`\"{}} content encodings as well. The default I/O timeout value is 300,000 milliseconds (5 minutes). Note that the timeout value applies to individual internal \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} operations; for this reason for large transfers the overall I/O time could exceed the timeout value. When an exception is thrown (for example, a response code of $<$ {\ttfamily 100} or $>$= {\ttfamily 400} is received from the server), any message body returned will be in the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash. This class understands the protocols in the following table.~\newline ~\newline {\bfseries{HTTPClient Class Protocols}} \tabulinesep=1mm \begin{longtabu}spread 0pt [c]{*{4}{|X[-1]}|} \hline {\bfseries{Protocol/\+Scheme}} &{\bfseries{Default Port}} &{\bfseries{SSL?}} &{\bfseries{Description}} \\\cline{1-4} {\ttfamily http} &{\ttfamily 80} &No &Unencrypted HTTP protocol \\\cline{1-4} {\ttfamily https} &{\ttfamily 443} &Yes &HTTP protocol with SSL/\+TLS encryption \\\cline{1-4} \end{longtabu} Whenever using an \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} method where a hash of headers can be passed to the method, some headers are generated by default by the class and can be overridden, and some are cannot be overridden and are ignored if passed by the client. See the following tables for details. {\bfseries{HTTPClient Mandatory Headers}} \tabulinesep=1mm \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|} \hline {\bfseries{Header}} &{\bfseries{Description}} \\\cline{1-2} {\ttfamily Content-\/\+Length} &This header is only sent if a message body is sent, and, if so, the length is calculated automatically. \\\cline{1-2} \end{longtabu} {\bfseries{HTTPClient Default, but Overridable Headers}} \tabulinesep=1mm \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|} \hline {\bfseries{Header}} &{\bfseries{Default Value}} \\\cline{1-2} {\ttfamily Accept} &{\ttfamily \char`\"{}text/html\char`\"{}} \\\cline{1-2} {\ttfamily Content-\/\+Type} &{\ttfamily \char`\"{}text/html\char`\"{}} \\\cline{1-2} {\ttfamily User-\/\+Agent} &{\ttfamily \char`\"{}\+Qore-\/\+HTTP-\/\+Client/0.\+8.\+8\char`\"{}} \\\cline{1-2} {\ttfamily Connection} &{\ttfamily \char`\"{}\+Keep-\/\+Alive\char`\"{}} \\\cline{1-2} {\ttfamily Accept-\/\+Encoding} &{\ttfamily \char`\"{}gzip,deflate,bzip2\char`\"{}} \\\cline{1-2} \end{longtabu} Note that if the {\ttfamily Content-\/\+Type} header is sent without a {\ttfamily \char`\"{};charset=xxx\char`\"{}} or {\ttfamily \char`\"{};boundary=xxxx\char`\"{}} specification, and a string is used as the message body for the request and the string does not have {\ttfamily ISO-\/8859-\/1} encoding, a {\ttfamily \char`\"{};charset=xxx\char`\"{}} string will be appended to the {\ttfamily Content-\/\+Type} header to ensure that the message is received and processed correctly on the remote end. In all other cases the caller is responsible for correctly setting the {\ttfamily Content-\/\+Type} header including any necessary {\ttfamily \char`\"{}\+:charset=xxx\char`\"{}} specification. This class supports posting network events to a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}}. See \mbox{\hyperlink{event_handling}{I/O Event Handling}} for more information. The events raised by this object are listed in the following table\+: {\bfseries{\mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} Events}} \tabulinesep=1mm \begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|} \hline {\bfseries{Name}} &{\bfseries{Description}} \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_CONTENT_LENGTH}{EVENT\+\_\+\+HTTP\+\_\+\+CONTENT\+\_\+\+LENGTH}} &Raised when the HTTP {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_START}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+START}} &Raised when HTTP chunked data is about to be received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_END}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+END}} &Raised when all HTTP chunked data has been received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_REDIRECT}{EVENT\+\_\+\+HTTP\+\_\+\+REDIRECT}} &Raised when an HTTP redirect message is received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}} &Raised when an HTTP message is sent. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}} &Raised when an HTTP message is received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}} &Raised when HTTP footers are received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_DATA_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+DATA\+\_\+\+RECEIVED}} &Raised when a block of HTTP chunked data is received. \\\cline{1-2} \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}} &Raised when the next chunk size for HTTP chunked data is known. \\\cline{1-2} \end{longtabu} \hypertarget{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{}\doxysubsection{HTTP GET Requests With a Message Body}\label{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body} The Qore \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} class allows {\ttfamily GET} requests to be made with a message body, however please note that this is a bad practice according to HTTP 1.\+1 RFCs; specifically\+: \begin{DoxyItemize} \item \href{https://tools.ietf.org/html/rfc2616\#section-4.3}{\texttt{ RFC 2616 section 4.\+3}}\+: \begin{DoxyVerb}if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.\end{DoxyVerb} \item \href{https://tools.ietf.org/html/rfc7231\#section-4.3.1}{\texttt{ RFC 7231 section 4.\+3.\+1}}\+: \begin{DoxyVerb}A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.\end{DoxyVerb} \end{DoxyItemize} Therefore we can conclude that {\ttfamily GET} methods do not include defined semantics, and therefore message bodies included with {\ttfamily GET} requests {\ttfamily SHOULD} be ignored according to the HTTP 1.\+1 spec, therefore it\textquotesingle{}s recommended not to send a message body with a {\ttfamily GET} request if standards compliance and compatibility is a goal. \begin{DoxyNote}{Note} \begin{DoxyItemize} \item This class is not available with the \mbox{\hyperlink{group__parse__options_ga20400e83c6271a294a48b15a8f952efa}{PO\+\_\+\+NO\+\_\+\+NETWORK}} parse option. \item URLs with UNIX sockets are generally supported in \mbox{\hyperlink{namespace_qore}{Qore}} with the following syntax\+: {\ttfamily {\bfseries{scheme\+://socket=}}}{\itshape url\+\_\+encoded\+\_\+path}{\ttfamily {\bfseries{/path}}}, where {\itshape url\+\_\+encoded\+\_\+path} is a path with URL-\/encoding as performed by \mbox{\hyperlink{group__misc__functions_ga639fba8c278c69ac4d4190ca1db19235}{encode\+\_\+url(string, True)}}; for example\+: {\ttfamily \char`\"{}http\+://socket=\%2ftmp\%socket-\/dir\%2fsocket-\/file-\/1/url/path\char`\"{}}; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well. \item HTTP headers should accept data in ISO-\/8859-\/1 (LATIN-\/1) encoding, but in practice for maximum compatibility US-\/\+ASCII should be used with any non-\/\+ASCII characters encoded with MIME encoded-\/word format according to \href{https://tools.ietf.org/html/rfc2047}{\texttt{ RFC 2047}}. This class currently only performs character encoding conversion on strings used as the message body. \item The default character encoding for this class is the same as the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} for Qore (normally {\ttfamily UTF-\/8}); this class does not include a {\ttfamily \char`\"{};charset=\char`\"{}} specification in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header when sending binary message boundaries \end{DoxyItemize} \end{DoxyNote} \begin{DoxySince}{Since} Qore 1.\+0 added code to add a {\ttfamily \char`\"{};charset=xxx\char`\"{}} to HTTP messages with a non-\/\+ISO-\/8859-\/1 string message body \end{DoxySince} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_acfc588c5d6f57c8a04a0f14819c90128}\label{class_qore_1_1_h_t_t_p_client_acfc588c5d6f57c8a04a0f14819c90128}} \index{Qore::HTTPClient@{Qore::HTTPClient}!addDefaultHeaders@{addDefaultHeaders}} \index{addDefaultHeaders@{addDefaultHeaders}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{addDefaultHeaders()}{addDefaultHeaders()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::add\+Default\+Headers (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{hdr }\end{DoxyParamCaption})} Sets headers to send by default with every outgoing request. \begin{DoxyParams}{Parameters} {\em hdr} & headers to send by default with every outgoing request\\ \hline \end{DoxyParams} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_af114b3a0915063dfd94b6cdd38fae9e7}{get\+Default\+Headers()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+5 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ad7688922670e2c8795a1ee680a2d51e3}\label{class_qore_1_1_h_t_t_p_client_ad7688922670e2c8795a1ee680a2d51e3}} \index{Qore::HTTPClient@{Qore::HTTPClient}!clearProxyURL@{clearProxyURL}} \index{clearProxyURL@{clearProxyURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{clearProxyURL()}{clearProxyURL()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::clear\+Proxy\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the new proxy URL value for the next connection. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxyURL();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ad555d0d81c335bb51820585b98888c12}\label{class_qore_1_1_h_t_t_p_client_ad555d0d81c335bb51820585b98888c12}} \index{Qore::HTTPClient@{Qore::HTTPClient}!clearProxyUserPassword@{clearProxyUserPassword}} \index{clearProxyUserPassword@{clearProxyUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{clearProxyUserPassword()}{clearProxyUserPassword()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::clear\+Proxy\+User\+Password (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the username and password for the next proxy connection. Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} to clear any proxy authentication information present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.clearProxyUserPassword();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a626dc7ce23d1f0e2d7f02e3c8499f8f9}\label{class_qore_1_1_h_t_t_p_client_a626dc7ce23d1f0e2d7f02e3c8499f8f9}} \index{Qore::HTTPClient@{Qore::HTTPClient}!clearStats@{clearStats}} \index{clearStats@{clearStats}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{clearStats()}{clearStats()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::clear\+Stats (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears performance statistics. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.clearStats();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySince}{Since} \mbox{\hyperlink{namespace_qore}{Qore}} 0.\+8.\+9 \end{DoxySince} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae98cfa16a0a9d4120e839f924d297d88}{HTTPClient\+::get\+Usage\+Info()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a9759d21c503bea0563dd8eaf6d6cfbd1}\label{class_qore_1_1_h_t_t_p_client_a9759d21c503bea0563dd8eaf6d6cfbd1}} \index{Qore::HTTPClient@{Qore::HTTPClient}!clearUserPassword@{clearUserPassword}} \index{clearUserPassword@{clearUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{clearUserPassword()}{clearUserPassword()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::clear\+User\+Password (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the username and password for the connection. Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} to clear any authentication information present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.clearUserPassword();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a4102b502a8be8262eecea4e0a85ebe5b}\label{class_qore_1_1_h_t_t_p_client_a4102b502a8be8262eecea4e0a85ebe5b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!clearWarningQueue@{clearWarningQueue}} \index{clearWarningQueue@{clearWarningQueue}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{clearWarningQueue()}{clearWarningQueue()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::clear\+Warning\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Removes any warning \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object from the \mbox{\hyperlink{class_qore_1_1_socket}{Socket}}. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.clearWarningQueue();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} \mbox{\hyperlink{namespace_qore}{Qore}} 0.\+8.\+9 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}\label{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}} \index{Qore::HTTPClient@{Qore::HTTPClient}!connect@{connect}} \index{connect@{connect}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{connect()}{connect()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::connect (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Connects to the remote socket; SSL/\+TLS negotiation is performed if required. If the protocol indicates that a secure connection should be established (or \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5d0b8c0b6fe386efb42367d81cc20e51}{HTTPClient\+::set\+Secure()}} was called previsouly), SSL/\+TLS negotiation will be attempted. If the {\ttfamily TCP\+\_\+\+NODELAY} flag has been set (see \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae6d797291f0f87d5243e40d2f8ea2bb7}{HTTPClient\+::set\+No\+Delay()}}), then after a successful connection to the remote socket, this option will be set on the socket. If an error occurs setting the {\ttfamily TCP\+\_\+\+NODELAY} option, the internal flag is set to false (use \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a3f9632f945cdd1df380d2831e73c924b}{HTTPClient\+::get\+No\+Delay()}} to check the flag\textquotesingle{}s state) and the error code can be retrieved with \mbox{\hyperlink{namespace_qore_abcf45c25ca1234fc8c54761750324cda}{errno()}}. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.connect();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParagraph}{Events\+:} \mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}} \end{DoxyParagraph} \begin{DoxyNote}{Note} For possible exceptions, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections). \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}\label{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}} \index{Qore::HTTPClient@{Qore::HTTPClient}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::constructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Creates the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{HTTPClient httpclient();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ab47546e6ce9925e09adf2ae181708694}\label{class_qore_1_1_h_t_t_p_client_ab47546e6ce9925e09adf2ae181708694}} \index{Qore::HTTPClient@{Qore::HTTPClient}!constructor@{constructor}} \index{constructor@{constructor}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{opts }\end{DoxyParamCaption})} Creates the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object based on the option parameter passed. To connect, call any method that requires a connection and an implicit connection is established, or call \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}}. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{HTTPClient httpclient((\textcolor{stringliteral}{"{}url"{}}:\textcolor{stringliteral}{"{}http://hostname:8080/path"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em opts} & sets options and changes default behaviour for the object, etc; key names are case-\/sensitive and therefore must all be in lower-\/case\+: \begin{DoxyItemize} \item {\ttfamily additional\+\_\+methods\+:} An optional hash defining additional HTTP methods to handle. This allows the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} class to handle various HTTP extensions like e.\+g. Web\+DAV. The hash is defined with new method names as keys; the values are \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} indicating if the method can accept a message body; for example\+: \begin{DoxyCode}{1} \DoxyCodeLine{\textcolor{comment}{\# add two new HTTP methods for WebDAV; both require message bodies}} \DoxyCodeLine{HTTPClient httpclient(\{\textcolor{stringliteral}{"{}url"{}}: url, \textcolor{stringliteral}{"{}additional\_methods"{}}: \{\textcolor{stringliteral}{"{}PROPFIND"{}}: \textcolor{keyword}{True}, \textcolor{stringliteral}{"{}MKCOL"{}}: \textcolor{keyword}{True}\}\});} \end{DoxyCode} \item {\ttfamily assume\+\_\+encoding\+:} assumes the given encoding if the server does not send a charset value \item {\ttfamily connect\+\_\+timeout\+:} The timeout value in milliseconds for establishing a new socket connection (also can be a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date-\/time value}} for clarity, ex\+: {\ttfamily 30s}) \item {\ttfamily default\+\_\+path\+:} The default path to use for new connections if a path is not otherwise specified in the connection URL \item {\ttfamily default\+\_\+port\+:} The default port number to connect to if none is given in the URL \item {\ttfamily encoding\+:} The default character encoding for outgoing messge bodies \item {\ttfamily encoding\+\_\+passthru\+:} Do not decode known content-\/encodings but rather pass the body through as-\/is \item {\ttfamily error\+\_\+passthru\+:} If \mbox{\hyperlink{basic_data_types_True}{True}} then HTTP status codes indicating errors will not cause an {\ttfamily HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} exception to be raised, rather such responses will be passed through to the caller like any other response \item {\ttfamily headers\+:} A hash of headers to send in every outgoing request \item {\ttfamily http\+\_\+version\+:} Either {\ttfamily \char`\"{}1.\+0\char`\"{}} or {\ttfamily \char`\"{}1.\+1\char`\"{}} for the claimed HTTP protocol version compliancy in outgoing message headers \item {\ttfamily max\+\_\+redirects\+:} The maximum number of redirects before throwing an exception (the default is 5) \item {\ttfamily protocols\+:} A hash describing new protocols, the key is the protocol name and the value is either an integer giving the default port number or a hash with {\ttfamily \char`\"{}port\char`\"{}} and {\ttfamily \char`\"{}ssl\char`\"{}} keys giving the default port number and a boolean value to indicate that an SSL connection should be established \item {\ttfamily proxy\+:} The proxy URL for connecting through a proxy \item {\ttfamily redirect\+\_\+passthru\+:} if \mbox{\hyperlink{basic_data_types_True}{True}} then redirect responses will be passed to the caller instead of processed \item {\ttfamily ssl\+\_\+cert\+\_\+data\+:} a binary (DER) or string (PEM) value representing the certificate; if this option is used, then {\ttfamily ssl\+\_\+cert\+\_\+path} is ignored \item {\ttfamily ssl\+\_\+cert\+\_\+path\+:} a path to an X.\+509 client certificate file in PEM format; if this option is used, then the calling context must not be restricted with sandbox restriction \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} which is checked at runtime \item {\ttfamily ssl\+\_\+key\+\_\+data\+:} a binary (DER) or string (PEM) value representing the private key; if this option is used, then {\ttfamily ssl\+\_\+key\+\_\+path} is ignored \item {\ttfamily ssl\+\_\+key\+\_\+path\+:} a path to a private key file in PEM format for the X.\+509 client certificate; if this option is used, then the calling context must not be restricted with sandbox restriction \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} which is checked at runtime \item {\ttfamily ssl\+\_\+key\+\_\+password\+:} the password to the private key given with {\ttfamily ssl\+\_\+key\+\_\+path} \item {\ttfamily ssl\+\_\+verify\+\_\+cert\+:} if \mbox{\hyperlink{basic_data_types_True}{True}} then the server\textquotesingle{}s certificate will only be accepted if it\textquotesingle{}s verified \item {\ttfamily timeout\+:} The timeout value in milliseconds (also can be a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date-\/time value}} for clarity, ex\+: {\ttfamily 5m}) \item {\ttfamily url\+:} A string giving the URL to connect to \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+OPTION-\/\+ERROR} & invalid or unknown option passed in option hash \\ \hline {\em HTTP-\/\+CLIENT-\/\+URL-\/\+ERROR} & invalid URL string \\ \hline {\em HTTP-\/\+CLIENT-\/\+UNKNOWN-\/\+PROTOCOL} & unknown protocol passed in URL \\ \hline {\em ILLEGAL-\/\+FILESYSTEM-\/\+ACCESS} & if the calling context is restricted with the \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} sandboxing restriction and one of the following options is used\+: {\ttfamily ssl\+\_\+cert\+\_\+path} or {\ttfamily ssl\+\_\+key\+\_\+path} \\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item URLs with UNIX sockets are generally supported in \mbox{\hyperlink{namespace_qore}{Qore}} with the following syntax\+: {\ttfamily {\bfseries{scheme\+://socket=}}}{\itshape url\+\_\+encoded\+\_\+path}{\ttfamily {\bfseries{/path}}}, where {\itshape url\+\_\+encoded\+\_\+path} is a path with URL-\/encoding as performed by \mbox{\hyperlink{group__misc__functions_ga639fba8c278c69ac4d4190ca1db19235}{encode\+\_\+url(string, True)}}; for example\+: {\ttfamily \char`\"{}http\+://socket=\%2ftmp\%socket-\/dir\%2fsocket-\/file-\/1/url/path\char`\"{}}; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well. \item Other I/O errors can be thrown opening and reading the certificate and/or private key files if the {\ttfamily ssl\+\_\+cert\+\_\+path} or {\ttfamily ssl\+\_\+key\+\_\+path} options are used \item The \mbox{\hyperlink{group__parse__options_ga5e466ed886222f0b57b0a399b455be71}{Qore\+::\+PO\+\_\+\+NO\+\_\+\+FILESYSTEM}} sandbox restriction is checked at runtime if one of the following options is used\+: {\ttfamily ssl\+\_\+cert\+\_\+path} or {\ttfamily ssl\+\_\+key\+\_\+path} \end{DoxyItemize} \end{DoxyNote} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+13 added the following options\+: \begin{DoxyItemize} \item {\ttfamily ssl\+\_\+cert\+\_\+path} \item {\ttfamily ssl\+\_\+key\+\_\+path} \item {\ttfamily ssl\+\_\+key\+\_\+password} \item {\ttfamily ssl\+\_\+verify\+\_\+cert} \end{DoxyItemize} \item Qore 0.\+9.\+3 added the following options\+: \begin{DoxyItemize} \item {\ttfamily encoding\+\_\+passthru} \item {\ttfamily error\+\_\+passthru} \item {\ttfamily redirect\+\_\+passthru} \end{DoxyItemize} \item Qore 0.\+9.\+4.\+2 added the following option\+: \begin{DoxyItemize} \item {\ttfamily assume\+\_\+encoding} \end{DoxyItemize} \item Qore 0.\+9.\+4.\+6 added the following option\+: \begin{DoxyItemize} \item {\ttfamily encoding} \end{DoxyItemize} \item Qore 0.\+9.\+5 added the following option\+: \begin{DoxyItemize} \item {\ttfamily headers} \end{DoxyItemize} \item Qore 1.\+10 added the following options\+: \begin{DoxyItemize} \item {\ttfamily ssl\+\_\+cert\+\_\+data} \item {\ttfamily ssl\+\_\+key\+\_\+data} \end{DoxyItemize} \end{DoxyItemize} \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aa2aa9b3adf0a30ea41bc521ab240055b}\label{class_qore_1_1_h_t_t_p_client_aa2aa9b3adf0a30ea41bc521ab240055b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!copy@{copy}} \index{copy@{copy}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Copying objects of this class is not supported, an exception will be thrown. \begin{DoxyExceptions}{Exceptions} {\em HTTPCLIENT-\/\+COPY-\/\+ERROR} & copying \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} objects is not yet supported \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ad8e70fc5524dfb8931f0bfab47326995}\label{class_qore_1_1_h_t_t_p_client_ad8e70fc5524dfb8931f0bfab47326995}} \index{Qore::HTTPClient@{Qore::HTTPClient}!destructor@{destructor}} \index{destructor@{destructor}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{destructor()}{destructor()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::destructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Destroys the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object and closes any open connections. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{delete httpclient;} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aeaa701096e2089dd42de81fb177730e9}\label{class_qore_1_1_h_t_t_p_client_aeaa701096e2089dd42de81fb177730e9}} \index{Qore::HTTPClient@{Qore::HTTPClient}!disconnect@{disconnect}} \index{disconnect@{disconnect}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{disconnect()}{disconnect()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::disconnect (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Disconnects from the remote socket if a connection is established (otherwise does nothing) \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.disconnect();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ac4b1dbf34a656d23a89e719a8dadac38}\label{class_qore_1_1_h_t_t_p_client_ac4b1dbf34a656d23a89e719a8dadac38}} \index{Qore::HTTPClient@{Qore::HTTPClient}!get@{get}} \index{get@{get}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{get()}{get()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP {\ttfamily GET} request and returns the message body received as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no message body is received. In order to get the headers and the body, use the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{HTTPClient\+::send()}} method instead (although note that sending an HTTP message bosdy with a {\ttfamily GET} request is not standards compliant; see \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} for more information). If no connection has already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the request. If any content encoding is used for the message body in the reply, the content is decoded and returned as a string; if the content encoding uses an unknown method, then an exception is thrown. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string html = httpclient.get(\textcolor{stringliteral}{"{}/path/file.html"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em path} & the path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em info} & an optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the message body in the reply to this message or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} in case of an error or an erroneous reply by the server with no body \end{DoxyReturn} \begin{DoxyParagraph}{Events\+:} \mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CONTENT_LENGTH}{EVENT\+\_\+\+HTTP\+\_\+\+CONTENT\+\_\+\+LENGTH}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_START}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+START}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_END}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+END}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_DATA_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+DATA\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_REDIRECT}{EVENT\+\_\+\+HTTP\+\_\+\+REDIRECT}} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a5a665637cd08310c5c4296d0e88a4bb7}\label{class_qore_1_1_h_t_t_p_client_a5a665637cd08310c5c4296d0e88a4bb7}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getAssumedEncoding@{getAssumedEncoding}} \index{getAssumedEncoding@{getAssumedEncoding}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getAssumedEncoding()}{getAssumedEncoding()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Assumed\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns the assumed character encoding for messages from the HTTP server without any charset indicator \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{RET\+\_\+\+VALUE\+\_\+\+ONLY}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{string str = httpclient.getAssumedEncoding();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} the assumed character encoding for messages from the HTTP server without any charset indicator; by default this is {\ttfamily \char`\"{}\+ISO-\/8859-\/1\char`\"{}} \end{DoxyReturn} \begin{DoxySince}{Since} Qore 0.\+9.\+4.\+2 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a1d0fef0b049abca0d26c931c5e8f020b}\label{class_qore_1_1_h_t_t_p_client_a1d0fef0b049abca0d26c931c5e8f020b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getConnectionPath@{getConnectionPath}} \index{getConnectionPath@{getConnectionPath}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getConnectionPath()}{getConnectionPath()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Connection\+Path (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current connection path set in the URL. \begin{DoxyReturn}{Returns} the current connection path set in the URL \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string path = httpclient.getConnectionPath();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9f2e9160de50ea228613df0f4ddc4eac}{set\+Connection\+Path()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a7513f6c2118f0d8de7dd15cb8ddbc21b}\label{class_qore_1_1_h_t_t_p_client_a7513f6c2118f0d8de7dd15cb8ddbc21b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getConnectTimeout@{getConnectTimeout}} \index{getConnectTimeout@{getConnectTimeout}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getConnectTimeout()}{getConnectTimeout()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+HTTPClient\+::get\+Connect\+Timeout (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the connect timeout as an integer in milliseconds. \begin{DoxyReturn}{Returns} Returns the connect timeout as an integer in milliseconds; negative numbers mean the system default timeout is used \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{int to = httpclient.getConnectTimeout();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_af114b3a0915063dfd94b6cdd38fae9e7}\label{class_qore_1_1_h_t_t_p_client_af114b3a0915063dfd94b6cdd38fae9e7}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getDefaultHeaders@{getDefaultHeaders}} \index{getDefaultHeaders@{getDefaultHeaders}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getDefaultHeaders()}{getDefaultHeaders()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}},\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}$>$ Qore\+::\+HTTPClient\+::get\+Default\+Headers (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns a hash of default headers to be sent with every outgoing request. \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} a hash of default headers to be sent with every outgoing request \end{DoxyReturn} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_acfc588c5d6f57c8a04a0f14819c90128}{add\+Default\+Headers()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+5 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a2917c58f43d176b49075d6db1c517ea5}\label{class_qore_1_1_h_t_t_p_client_a2917c58f43d176b49075d6db1c517ea5}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getDefaultPath@{getDefaultPath}} \index{getDefaultPath@{getDefaultPath}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getDefaultPath()}{getDefaultPath()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Default\+Path (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the default path used by the object if no path is set in the URL. \begin{DoxyReturn}{Returns} the default path used by the object if no path is set in the URL \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string def\_path = httpclient.getDefaultPath();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a913167ec6f9c386e67cc0178761b0f61}\label{class_qore_1_1_h_t_t_p_client_a913167ec6f9c386e67cc0178761b0f61}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getEncoding@{getEncoding}} \index{getEncoding@{getEncoding}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getEncoding()}{getEncoding()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the character encoding used for the object. \begin{DoxyReturn}{Returns} the character encoding used for the object \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{string encoding = httpclient.getEncoding();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a022d5d67e51ad2d2742e8f43f02f5dce}\label{class_qore_1_1_h_t_t_p_client_a022d5d67e51ad2d2742e8f43f02f5dce}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getEncodingPassthru@{getEncodingPassthru}} \index{getEncodingPassthru@{getEncodingPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getEncodingPassthru()}{getEncodingPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::get\+Encoding\+Passthru (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} get the encoding passthru status \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.getErrorPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} the current {\ttfamily encoding\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then message bodies received with known content encodings are not decoded but rather passed through as-\/is \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a6cdbac64375086f309b6d2737721814a}\label{class_qore_1_1_h_t_t_p_client_a6cdbac64375086f309b6d2737721814a}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getErrorPassthru@{getErrorPassthru}} \index{getErrorPassthru@{getErrorPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getErrorPassthru()}{getErrorPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::get\+Error\+Passthru (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} get the error passthru status \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.getErrorPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} the current {\ttfamily error\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then HTTP status codes indicating errors will not cause an {\ttfamily HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} exception to be raised, rather such responses will be passed through to the caller like any other response. \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a00ba9d3416ca2c73444ab2b585a3e53f}\label{class_qore_1_1_h_t_t_p_client_a00ba9d3416ca2c73444ab2b585a3e53f}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getHostHeaderValue@{getHostHeaderValue}} \index{getHostHeaderValue@{getHostHeaderValue}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getHostHeaderValue()}{getHostHeaderValue()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Host\+Header\+Value (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} returns the {\ttfamily Host} header value for this object \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{string host = httpclient.getHostHeaderValue();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} the {\ttfamily Host} header value for this object \end{DoxyReturn} \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a4e2d0ff10616b7bba8a6ffe2b1cecd38}\label{class_qore_1_1_h_t_t_p_client_a4e2d0ff10616b7bba8a6ffe2b1cecd38}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getHTTPVersion@{getHTTPVersion}} \index{getHTTPVersion@{getHTTPVersion}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getHTTPVersion()}{getHTTPVersion()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+HTTPVersion (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the HTTP protocol version string used in outgoing messages. \begin{DoxyReturn}{Returns} the HTTP protocol version string used in outgoing messages \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{string version = httpclient.getHTTPVersion();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_afbb1c7d48fc1b1dcba32e1051041bfae}\label{class_qore_1_1_h_t_t_p_client_afbb1c7d48fc1b1dcba32e1051041bfae}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getMaxRedirects@{getMaxRedirects}} \index{getMaxRedirects@{getMaxRedirects}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getMaxRedirects()}{getMaxRedirects()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+HTTPClient\+::get\+Max\+Redirects (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current {\ttfamily max\+\_\+redirects} value for the object (the maximum number of HTTP redirects that will be processed before an exception is raised) \begin{DoxyReturn}{Returns} the current {\ttfamily max\+\_\+redirects} value for the object (the maximum number of HTTP redirects that will be processed before an exception is raised) \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{int mr = httpclient.getMaxRedirects();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a3f9632f945cdd1df380d2831e73c924b}\label{class_qore_1_1_h_t_t_p_client_a3f9632f945cdd1df380d2831e73c924b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getNoDelay@{getNoDelay}} \index{getNoDelay@{getNoDelay}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getNoDelay()}{getNoDelay()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::get\+No\+Delay (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the {\ttfamily TCP\+\_\+\+NODELAY} setting for the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object. \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.getNoDelay();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} also \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae6d797291f0f87d5243e40d2f8ea2bb7}{HTTPClient\+::set\+No\+Delay()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a3018d4114a87d90d914a0ed62e924e83}\label{class_qore_1_1_h_t_t_p_client_a3018d4114a87d90d914a0ed62e924e83}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getProxyURL@{getProxyURL}} \index{getProxyURL@{getProxyURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getProxyURL()}{getProxyURL()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Proxy\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current proxy URL as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no proxy URL is set. \begin{DoxyReturn}{Returns} the current proxy URL as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no proxy URL is set \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string proxy\_url = httpclient.getProxyURL();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a4c1c05e984dd44879c031f279e41c0a4}{get\+Safe\+Proxy\+URL()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ae0c812e5462014718091864a8d9ad07c}\label{class_qore_1_1_h_t_t_p_client_ae0c812e5462014718091864a8d9ad07c}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getRedirectPassthru@{getRedirectPassthru}} \index{getRedirectPassthru@{getRedirectPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getRedirectPassthru()}{getRedirectPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::get\+Redirect\+Passthru (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} get the redirect passthru status \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.getRedirectPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} the current {\ttfamily reddirect\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then redirect messages will be passed to the caller instead of proceessed \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a4c1c05e984dd44879c031f279e41c0a4}\label{class_qore_1_1_h_t_t_p_client_a4c1c05e984dd44879c031f279e41c0a4}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getSafeProxyURL@{getSafeProxyURL}} \index{getSafeProxyURL@{getSafeProxyURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getSafeProxyURL()}{getSafeProxyURL()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Safe\+Proxy\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current proxy URL without the password field. \begin{DoxyReturn}{Returns} the current proxy URL with the scheme, address, port (if not the default) and also including any username and path, but without any password \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string url = httpclient.getSafeProxyURL();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a3018d4114a87d90d914a0ed62e924e83}{get\+Proxy\+URL()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 1.\+6.\+0 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_abae73dc4d3029d572a73e851251b06d6}\label{class_qore_1_1_h_t_t_p_client_abae73dc4d3029d572a73e851251b06d6}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getSafeURL@{getSafeURL}} \index{getSafeURL@{getSafeURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getSafeURL()}{getSafeURL()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+Safe\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current URL without the password field. \begin{DoxyReturn}{Returns} the current URL with the scheme, address, port (if not the default) and also including any username and path, but without any password \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string url = httpclient.getSafeURL();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}{get\+URL()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 1.\+6.\+0 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ad8dea5c7fcbfbcdc3408f2d62922f3b1}\label{class_qore_1_1_h_t_t_p_client_ad8dea5c7fcbfbcdc3408f2d62922f3b1}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getTimeout@{getTimeout}} \index{getTimeout@{getTimeout}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getTimeout()}{getTimeout()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+HTTPClient\+::get\+Timeout (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the default I/O timeout as an integer in milliseconds. \begin{DoxyReturn}{Returns} the default I/O timeout as an integer in milliseconds; 0 means immediate timeout (when reading only returns data if it is already available), and negative numbers mean never timeout \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{int timeout = httpclient.getTimeout();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}\label{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getURL@{getURL}} \index{getURL@{getURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getURL()}{getURL()}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::get\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the current URL. \begin{DoxyReturn}{Returns} the current URL with the scheme, address, port (if not the default) and also including any username, password, and path \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{*string url = httpclient.getURL();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_abae73dc4d3029d572a73e851251b06d6}{get\+Safe\+URL()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ae98cfa16a0a9d4120e839f924d297d88}\label{class_qore_1_1_h_t_t_p_client_ae98cfa16a0a9d4120e839f924d297d88}} \index{Qore::HTTPClient@{Qore::HTTPClient}!getUsageInfo@{getUsageInfo}} \index{getUsageInfo@{getUsageInfo}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{getUsageInfo()}{getUsageInfo()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+HTTPClient\+::get\+Usage\+Info (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns performance statistics for the socket. \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{hash h = httpclient.getUsageInfo();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyReturn}{Returns} a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}bytes\+\_\+sent\char`\"{}}\+: an integer giving the total amount of bytes sent \item {\ttfamily \char`\"{}bytes\+\_\+recv\char`\"{}}\+: an integer giving the total amount of bytes received \item {\ttfamily \char`\"{}us\+\_\+sent\char`\"{}}\+: an integer giving the total number of microseconds spent sending data \item {\ttfamily \char`\"{}us\+\_\+recv\char`\"{}}\+: an integer giving the total number of microseconds spent receiving data \item {\ttfamily \char`\"{}arg\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}}) the optional argument for warning hashes \item {\ttfamily \char`\"{}timeout\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}}) the warning timeout in microseconds \item {\ttfamily \char`\"{}min\+\_\+throughput\char`\"{}}\+: (only if warning values have been set with \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}}) the minimum warning throughput in bytes/sec \end{DoxyItemize} \end{DoxyReturn} \begin{DoxySince}{Since} \mbox{\hyperlink{namespace_qore}{Qore}} 0.\+8.\+9 \end{DoxySince} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a626dc7ce23d1f0e2d7f02e3c8499f8f9}{HTTPClient\+::clear\+Stats()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aa69855f942fa531e159115ec5635519a}\label{class_qore_1_1_h_t_t_p_client_aa69855f942fa531e159115ec5635519a}} \index{Qore::HTTPClient@{Qore::HTTPClient}!head@{head}} \index{head@{head}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{head()}{head()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+HTTPClient\+::head (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP {\ttfamily HEAD} request and returns as hash of the headers received. If no connection is established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{hash msg = httpclient.head(\textcolor{stringliteral}{"{}/path"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em path} & the path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em info} & an optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the headers received from the HTTP server with all key names converted to lower-\/case \end{DoxyReturn} \begin{DoxyParagraph}{Events\+:} \mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_REDIRECT}{EVENT\+\_\+\+HTTP\+\_\+\+REDIRECT}} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_adbee3f312158d29d873527085eb48bea}\label{class_qore_1_1_h_t_t_p_client_adbee3f312158d29d873527085eb48bea}} \index{Qore::HTTPClient@{Qore::HTTPClient}!isConnected@{isConnected}} \index{isConnected@{isConnected}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{isConnected()}{isConnected()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::is\+Connected (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} giving the current connection state. \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} or \mbox{\hyperlink{basic_data_types_False}{False}} giving the current connection state \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.isConnected();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a04c2df5e6fca680874e388a093fa136a}\label{class_qore_1_1_h_t_t_p_client_a04c2df5e6fca680874e388a093fa136a}} \index{Qore::HTTPClient@{Qore::HTTPClient}!isProxySecure@{isProxySecure}} \index{isProxySecure@{isProxySecure}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{isProxySecure()}{isProxySecure()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::is\+Proxy\+Secure (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns the SSL/\+TLS flag for the next proxy connection. \begin{DoxyReturn}{Returns} the SSL/\+TLS flag for the next proxy connection \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{bool b = httpclient.isProxySecure();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a5654958c7d5ca1106b092f85230a78f1}\label{class_qore_1_1_h_t_t_p_client_a5654958c7d5ca1106b092f85230a78f1}} \index{Qore::HTTPClient@{Qore::HTTPClient}!isSecure@{isSecure}} \index{isSecure@{isSecure}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{isSecure()}{isSecure()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::is\+Secure (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Returns \mbox{\hyperlink{basic_data_types_True}{True}} if the current connection is encrypted, \mbox{\hyperlink{basic_data_types_False}{False}} if not. \begin{DoxyReturn}{Returns} \mbox{\hyperlink{basic_data_types_True}{True}} if the current connection is encrypted, \mbox{\hyperlink{basic_data_types_False}{False}} if not \end{DoxyReturn} \begin{DoxyParagraph}{Code Flags\+:} \mbox{\hyperlink{code_flags_CONSTANT}{CONSTANT}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{keywordflow}{if} (httpclient.isSecure())} \DoxyCodeLine{ \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"{}secure connection: \%s \%s\(\backslash\)n"{}}, httpclient.getSSLCipherName(), httpclient.getSSLCipherVersion());} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a823277eb390140f90f6382df3806dbf3}\label{class_qore_1_1_h_t_t_p_client_a823277eb390140f90f6382df3806dbf3}} \index{Qore::HTTPClient@{Qore::HTTPClient}!post@{post}} \index{post@{post}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{post()}{post()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::post (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP {\ttfamily POST} request with a message body and returns the message body received as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no message body is received. In order to get the headers and the body in the response, use the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{HTTPClient\+::send()}} method instead. If no connection is established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.post(\textcolor{stringliteral}{"{}/path"{}}, body);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em path} & the path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em body} & the optional data to use as the message body \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em info} & an optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the message body in the reply to this message or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} in case no body was present in the response \end{DoxyReturn} \begin{DoxyParagraph}{Events\+:} \mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CONTENT_LENGTH}{EVENT\+\_\+\+HTTP\+\_\+\+CONTENT\+\_\+\+LENGTH}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_START}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+START}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_END}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+END}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_DATA_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+DATA\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_REDIRECT}{EVENT\+\_\+\+HTTP\+\_\+\+REDIRECT}} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ac3e1328f5f008a181ad066e5a3a73229}\label{class_qore_1_1_h_t_t_p_client_ac3e1328f5f008a181ad066e5a3a73229}} \index{Qore::HTTPClient@{Qore::HTTPClient}!post@{post}} \index{post@{post}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{post()}{post()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+HTTPClient\+::post (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP {\ttfamily POST} request with a message body and returns the message body received as a string or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if no message body is received. In order to get the headers and the body in the response, use the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{HTTPClient\+::send()}} method instead. If no connection is established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.post(\textcolor{stringliteral}{"{}/path"{}}, body);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em path} & the path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em body} & the string to use as the message body \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em info} & an optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the message body in the reply to this message or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} in case no body was present in the response \end{DoxyReturn} \begin{DoxyParagraph}{Events\+:} \mbox{\hyperlink{event_handling_EVENT_CONNECTING}{EVENT\+\_\+\+CONNECTING}}, \mbox{\hyperlink{event_handling_EVENT_CONNECTED}{EVENT\+\_\+\+CONNECTED}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_LOOKUP}{EVENT\+\_\+\+HOSTNAME\+\_\+\+LOOKUP}}, \mbox{\hyperlink{event_handling_EVENT_HOSTNAME_RESOLVED}{EVENT\+\_\+\+HOSTNAME\+\_\+\+RESOLVED}}, \mbox{\hyperlink{event_handling_EVENT_START_SSL}{EVENT\+\_\+\+START\+\_\+\+SSL}}, \mbox{\hyperlink{event_handling_EVENT_SSL_ESTABLISHED}{EVENT\+\_\+\+SSL\+\_\+\+ESTABLISHED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_SEND_MESSAGE}{EVENT\+\_\+\+HTTP\+\_\+\+SEND\+\_\+\+MESSAGE}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_SENT}{EVENT\+\_\+\+PACKET\+\_\+\+SENT}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_MESSAGE_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+MESSAGE\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_PACKET_READ}{EVENT\+\_\+\+PACKET\+\_\+\+READ}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CONTENT_LENGTH}{EVENT\+\_\+\+HTTP\+\_\+\+CONTENT\+\_\+\+LENGTH}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_START}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+START}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_END}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+END}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNKED_DATA_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNKED\+\_\+\+DATA\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_CHUNK_SIZE}{EVENT\+\_\+\+HTTP\+\_\+\+CHUNK\+\_\+\+SIZE}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_FOOTERS_RECEIVED}{EVENT\+\_\+\+HTTP\+\_\+\+FOOTERS\+\_\+\+RECEIVED}}, \mbox{\hyperlink{event_handling_EVENT_HTTP_REDIRECT}{EVENT\+\_\+\+HTTP\+\_\+\+REDIRECT}} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a6b1663b61eb0c6a992a077a8c0d7943b}\label{class_qore_1_1_h_t_t_p_client_a6b1663b61eb0c6a992a077a8c0d7943b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!send@{send}} \index{send@{send}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{send()}{send()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+HTTPClient\+::send (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{hash msg = httpclient.send(body, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em body} & The message body to send; pass \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (no value) to send no body \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The headers received from the HTTP server with all key names converted to lower-\/case. The message body (if any) will be assigned to the value of the {\ttfamily \char`\"{}body\char`\"{}} key and the HTTP status will be assigned to the {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key. \end{DoxyReturn} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a9899a18889d4099408c6939204e4d84f}\label{class_qore_1_1_h_t_t_p_client_a9899a18889d4099408c6939204e4d84f}} \index{Qore::HTTPClient@{Qore::HTTPClient}!send@{send}} \index{send@{send}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{send()}{send()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}]{os, }\item[{\+\_\+\+\_\+7\+\_\+ data}]{body, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info, }\item[{\+\_\+\+\_\+7\+\_\+ code}]{rcb }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and optional message body; headers are returned through an optional receive callback and any body received is written to the \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. This method is useful for receiving data in real time; data are sent to the output stream as soon as they are received. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{comment}{\# save the HTTP response body directly to a file with a random file name}} \DoxyCodeLine{string fn = tmp\_location() + DirSep + get\_random\_string() + \textcolor{stringliteral}{"{}.tmp"{}}} \DoxyCodeLine{FileOutputString output\_stream(fn);} \DoxyCodeLine{\textcolor{comment}{\# log the "{}X-\/Logme"{} header}} \DoxyCodeLine{code rcb = sub (hash h) \{} \DoxyCodeLine{ \textcolor{keywordflow}{if} (h.hdr.\textcolor{stringliteral}{"{}x-\/logme"{}})} \DoxyCodeLine{ log(\textcolor{stringliteral}{"{}X-\/Logme: \%y"{}}, h.hdr.\textcolor{stringliteral}{"{}x-\/logme"{}});} \DoxyCodeLine{\};} \DoxyCodeLine{httpclient.send(output\_stream, data, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}), NOTHING, NOTHING, NOTHING, rcb);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em os} & The \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}} to write the response body to \\ \hline {\em body} & The message body to send; pass \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (no value) to send no body \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request. \\ \hline {\em rcb} & An optional receive callback for message headers received only; header or trailer data is placed in a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message \item {\ttfamily \char`\"{}info\char`\"{}}\+: this hash is passed when headers are received; in this case, the hash has at least the the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}accept-\/charset\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header \item {\ttfamily \char`\"{}accept-\/encoding\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header \item {\ttfamily \char`\"{}body-\/content-\/type\char`\"{}}\+: the value of the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, if any, without any character set info \item {\ttfamily \char`\"{}charset\char`\"{}}\+: any character set value found in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header \item {\ttfamily \char`\"{}response-\/headers-\/raw\char`\"{}}\+: a hash of unprocessed headers with no case conversions or additional keys \end{DoxyItemize} \item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}} (see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}}) or if a receive callback is used \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} Qore 0.\+8.\+13 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}\label{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}} \index{Qore::HTTPClient@{Qore::HTTPClient}!send@{send}} \index{send@{send}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{send()}{send()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+HTTPClient\+::send (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and optional message body and returns headers and any body received as a response in a hash format. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{hash msg = httpclient.send(body, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em body} & The message body to send; note that sending an HTTP message bosdy with a {\ttfamily GET} request is not standards compliant; see \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} for more information \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The headers received from the HTTP server with all key names converted to lower-\/case. The message body (if any) will be assigned to the value of the {\ttfamily \char`\"{}body\char`\"{}} key and the HTTP status will be assigned to the {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key. \end{DoxyReturn} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a2b7084887db1c7b65744504feae95727}\label{class_qore_1_1_h_t_t_p_client_a2b7084887db1c7b65744504feae95727}} \index{Qore::HTTPClient@{Qore::HTTPClient}!sendChunked@{sendChunked}} \index{sendChunked@{sendChunked}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{sendChunked()}{sendChunked()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::send\+Chunked (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_output_stream}{Qore\+::\+Output\+Stream}}}]{os, }\item[{\mbox{\hyperlink{class_qore_1_1_input_stream}{Qore\+::\+Input\+Stream}}}]{is, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{max\+\_\+chunk\+\_\+size = {\ttfamily 4096}, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info, }\item[{\+\_\+\+\_\+7\+\_\+ code}]{rcb, }\item[{\+\_\+\+\_\+7\+\_\+ code}]{tcb }\end{DoxyParamCaption})} Sends a chunked HTTP request with the specified method and message body; headers are returned through an optional receive callback and any body received is written to the \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}}. This method is useful for receiving data in real time; data are sent to the output stream as soon as they are received. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{\textcolor{comment}{\# save the HTTP response body directly to a file with a random file name}} \DoxyCodeLine{string fn = tmp\_location() + DirSep + get\_random\_string() + \textcolor{stringliteral}{"{}.tmp"{}}} \DoxyCodeLine{FileOutputString output\_stream(fn);} \DoxyCodeLine{\textcolor{comment}{\# log the "{}X-\/Logme"{} header}} \DoxyCodeLine{code rcb = sub (hash h) \{} \DoxyCodeLine{ \textcolor{keywordflow}{if} (h.hdr.\textcolor{stringliteral}{"{}x-\/logme"{}})} \DoxyCodeLine{ log(\textcolor{stringliteral}{"{}X-\/Logme: \%y"{}}, h.hdr.\textcolor{stringliteral}{"{}x-\/logme"{}});} \DoxyCodeLine{\};} \DoxyCodeLine{\textcolor{comment}{\# write the "{}X-\/Content-\/Done"{} header when done}} \DoxyCodeLine{code tcb = *hash sub () \{} \DoxyCodeLine{ \textcolor{keywordflow}{return} \{\textcolor{stringliteral}{"{}X-\/Content-\/Done"{}}: \textcolor{stringliteral}{"{}true"{}}\};} \DoxyCodeLine{\};} \DoxyCodeLine{httpclient.sendChunked(output\_stream, input\_stream, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}), NOTHING, NOTHING, NOTHING, rcb, tcb);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em os} & The \mbox{\hyperlink{class_qore_1_1_output_stream}{Output\+Stream}} to write the response body to \\ \hline {\em is} & The \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} to read the request body from; each read will be sent as a separate chunk \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em max\+\_\+chunk\+\_\+size} & the maximum chunk size as the read block size for the \mbox{\hyperlink{class_qore_1_1_input_stream}{Input\+Stream}} read block size; the actual size of the data read will determine the size of each HTTP chunk \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request. \\ \hline {\em tcb} & An optional trailer callback for message trailers to write in the outgoing chunked message; the callback takes no arguments and must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}} giving a hash of trailers for the final chunk \\ \hline {\em rcb} & An optional receive callback for message headers received only; header or trailer data is placed in a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message \item {\ttfamily \char`\"{}info\char`\"{}}\+: this hash is passed when headers are received; in this case, the hash has at least the the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}accept-\/charset\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header \item {\ttfamily \char`\"{}accept-\/encoding\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header \item {\ttfamily \char`\"{}body-\/content-\/type\char`\"{}}\+: the value of the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, if any, without any character set info \item {\ttfamily \char`\"{}charset\char`\"{}}\+: any character set value found in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header \item {\ttfamily \char`\"{}response-\/headers-\/raw\+: a hash of unprocessed headers with no case conversions or additional keys -\/ \textbackslash{}c \char`\"{}obj\char`\"{}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) @param tcb An optional trailer callback for message trailers to write in the outgoing chunked message; the callback takes no arguments and must return either @ref nothing or @ref hash\+\_\+type \char`\"{}hash"{}} giving a hash of trailers for the final chunk \end{DoxyItemize} \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}} (see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}}) or if a receive callback is used \\ \hline {\em HTTP-\/\+CHUNK-\/\+ERROR} & the chunk size given is not greater than 0 \\ \hline {\em HTTP-\/\+TRAILER-\/\+ERROR} & the trailer callback must return either \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} or \mbox{\hyperlink{data_type_declarations_hash_type}{hash}}; this exception is thrown is another type is returned \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} Qore 0.\+8.\+13 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a9f59809a0a95796b7533b32cf614f527}\label{class_qore_1_1_h_t_t_p_client_a9f59809a0a95796b7533b32cf614f527}} \index{Qore::HTTPClient@{Qore::HTTPClient}!sendWithCallbacks@{sendWithCallbacks}} \index{sendWithCallbacks@{sendWithCallbacks}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{sendWithCallbacks()}{sendWithCallbacks()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::send\+With\+Callbacks (\begin{DoxyParamCaption}\item[{code}]{scb, }\item[{code}]{rcb, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and chunked message body as given by a send callback; headers and any body received are returned through a receive callback. This method is useful for sending chunked message data where the response is also sent with chunked transfer encoding; chunks are sent to the receive callback as soon as they are received. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.sendWithCallbacks(send\_callback, rcv\_callback, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em scb} & The callback giving the chunked HTTP data to send; this callback must return either a string or a binary value each time it is called to give the chunked data to send; when all data has been sent, then a hash of message trailers can be sent or simply \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} which will close the chunked message \\ \hline {\em rcb} & The receive callback for the data received; first this method is called with a hash of the message headers, and then with any message body; if a chunked HTTP message is received, then the callback is called once for each chunk; when the message has been received, then the receive callback is called with a hash representing any trailer data received in a chunked transfer or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the data was received in a normal message body or if there was no trailer data in a chunked transfer. The argument to this callback is always a hash; data calls have the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}data\char`\"{}}\+: the string or binary data \item {\ttfamily \char`\"{}chunked\char`\"{}}\+: True if the data was received with chunked transfer encoding, False if not \end{DoxyItemize}\\ \hline \end{DoxyParams} Header or trailer data is placed in a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message \item {\ttfamily \char`\"{}info\char`\"{}}\+: this hash is passed when headers are received; in this case, the hash has at least the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}accept-\/charset\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header \item {\ttfamily \char`\"{}accept-\/encoding\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header \item {\ttfamily \char`\"{}body-\/content-\/type\char`\"{}}\+: the value of the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, if any, without any character set info \item {\ttfamily \char`\"{}charset\char`\"{}}\+: any character set value found in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header \item {\ttfamily \char`\"{}response-\/headers-\/raw\char`\"{}}\+: a hash of unprocessed headers with no case conversions or additional keys \end{DoxyItemize} \item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) \item {\ttfamily \char`\"{}send\+\_\+aborted\char`\"{}}\+: this is set to \mbox{\hyperlink{basic_data_types_True}{True}} if a response header was set while sending an outgoing chunked message \begin{DoxyParams}{Parameters} {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+:\\ \hline \end{DoxyParams} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item The {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\+: chunked\char`\"{}} header is automatically set with this method if no {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header is already present \item if a response is received while the chunked send operation is still in progress, an error is assumed, the send operation is aborted, and the response header is read immediately and the {\ttfamily send\+\_\+aborted} flag is set in the argument to {\itshape rcb} \item For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyItemize} \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+10 \item Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxyItemize} \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a44d799ef24e73483c2d8816786d3dedd}\label{class_qore_1_1_h_t_t_p_client_a44d799ef24e73483c2d8816786d3dedd}} \index{Qore::HTTPClient@{Qore::HTTPClient}!sendWithRecvCallback@{sendWithRecvCallback}} \index{sendWithRecvCallback@{sendWithRecvCallback}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{sendWithRecvCallback()}{sendWithRecvCallback()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::send\+With\+Recv\+Callback (\begin{DoxyParamCaption}\item[{code}]{rcb, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}}}]{body, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and optional message body; headers and any body received are returned through a receive callback. This method is useful for receiving chunked message data in real time; chunks are sent to the receive callback as soon as they are received. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.sendWithRecvCallback(rcv\_callback, data, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em rcb} & The receive callback for the data received; first this method is called with a hash of the message headers, and then with any message body; if a chunked HTTP message is received, then the callback is called once for each chunk; when the message has been received, then the receive callback is called with a hash representing any trailer data received in a chunked transfer or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the data was received in a normal message body or if there was no trailer data in a chunked transfer. The argument to this callback is always a hash; data calls have the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}data\char`\"{}}\+: the string or binary data \item {\ttfamily \char`\"{}chunked\char`\"{}}\+: True if the data was received with chunked transfer encoding, False if not \end{DoxyItemize}\\ \hline \end{DoxyParams} Header or trailer data is placed in a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message \item {\ttfamily \char`\"{}info\char`\"{}}\+: this hash is passed when headers are received; in this case, the hash has at least the the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}accept-\/charset\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header \item {\ttfamily \char`\"{}accept-\/encoding\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header \item {\ttfamily \char`\"{}body-\/content-\/type\char`\"{}}\+: the value of the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, if any, without any character set info \item {\ttfamily \char`\"{}charset\char`\"{}}\+: any character set value found in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header \item {\ttfamily \char`\"{}response-\/headers-\/raw\char`\"{}}\+: a hash of unprocessed headers with no case conversions or additional keys \end{DoxyItemize} \item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) \begin{DoxyParams}{Parameters} {\em body} & The message body to send; pass \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} (no value) to send no body \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+:\\ \hline \end{DoxyParams} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+10 \item Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxyItemize} \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a38aeb117b3923c90cf6a1a6e6e05b239}\label{class_qore_1_1_h_t_t_p_client_a38aeb117b3923c90cf6a1a6e6e05b239}} \index{Qore::HTTPClient@{Qore::HTTPClient}!sendWithRecvCallback@{sendWithRecvCallback}} \index{sendWithRecvCallback@{sendWithRecvCallback}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{sendWithRecvCallback()}{sendWithRecvCallback()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::send\+With\+Recv\+Callback (\begin{DoxyParamCaption}\item[{code}]{rcb, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{body, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$$>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and optional message body; headers and any body received are returned through a receive callback. This method is useful for receiving chunked message data in real time; chunks are sent to the receive callback as soon as they are received. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.sendWithRecvCallback(rcv\_callback, data, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em rcb} & The receive callback for the data received; first this method is called with a hash of the message headers, and then with any message body; if a chunked HTTP message is received, then the callback is called once for each chunk; when the message has been received, then the receive callback is called with a hash representing any trailer data received in a chunked transfer or \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} if the data was received in a normal message body or if there was no trailer data in a chunked transfer. The argument to this callback is always a hash; data calls have the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}data\char`\"{}}\+: the string or binary data \item {\ttfamily \char`\"{}chunked\char`\"{}}\+: True if the data was received with chunked transfer encoding, False if not \end{DoxyItemize}\\ \hline \end{DoxyParams} Header or trailer data is placed in a hash with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}hdr\char`\"{}}\+: this can be assigned to \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} for the trailer hash if the data was not sent chunked or no trailers were included in a chunked message \item {\ttfamily \char`\"{}info\char`\"{}}\+: this hash is passed when headers are received; in this case, the hash has at least the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}accept-\/charset\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header \item {\ttfamily \char`\"{}accept-\/encoding\char`\"{}}\+: the value of any {\ttfamily \char`\"{}\+Accept-\/\+Encoding\char`\"{}} header \item {\ttfamily \char`\"{}body-\/content-\/type\char`\"{}}\+: the value of the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, if any, without any character set info \item {\ttfamily \char`\"{}charset\char`\"{}}\+: any character set value found in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header \item {\ttfamily \char`\"{}response-\/headers-\/raw\char`\"{}}\+: a hash of unprocessed headers with no case conversions or additional keys \end{DoxyItemize} \item {\ttfamily \char`\"{}obj\char`\"{}}\+: this is the owning object (so socket parameters can be changed based on headers received, such as, for example, socket character encoding) \begin{DoxyParams}{Parameters} {\em body} & The message body to send \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+:\\ \hline \end{DoxyParams} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+10 \item Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxyItemize} \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aca21bac933b892a3cb27e77a50d9461a}\label{class_qore_1_1_h_t_t_p_client_aca21bac933b892a3cb27e77a50d9461a}} \index{Qore::HTTPClient@{Qore::HTTPClient}!sendWithSendCallback@{sendWithSendCallback}} \index{sendWithSendCallback@{sendWithSendCallback}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{sendWithSendCallback()}{sendWithSendCallback()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+HTTPClient\+::send\+With\+Send\+Callback (\begin{DoxyParamCaption}\item[{code}]{scb, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{method, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path, }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$}]{headers, }\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0}, }\item[{softbool}]{getbody = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}}}, }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}} $>$}]{info }\end{DoxyParamCaption})} Sends an HTTP request with the specified method and chunked message body as given by a send callback and returns headers and any body received as a response in a hash format. If a connection has not already been established, an internal call to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a6df282a9db795b68ac5332f2429c4e8e}{HTTPClient\+::connect()}} will be made before sending the message \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{hash msg = httpclient.sendWithSendCallback(callback, \textcolor{stringliteral}{"{}POST"{}}, \textcolor{stringliteral}{"{}/path"{}}, (\textcolor{stringliteral}{"{}Content-\/Type"{}}:\textcolor{stringliteral}{"{}application/x-\/yaml"{}}));} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em scb} & The callback giving the chunked HTTP data to send; this callback must return either a string or a binary value each time it is called to give the chunked data to send; when all data has been sent, then a hash of message trailers can be sent or simply \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} which will close the chunked message \\ \hline {\em method} & The name of the HTTP method ({\ttfamily \char`\"{}\+GET\char`\"{}}, {\ttfamily \char`\"{}\+POST\char`\"{}}, {\ttfamily \char`\"{}\+HEAD\char`\"{}}, {\ttfamily \char`\"{}\+OPTIONS\char`\"{}}, {\ttfamily \char`\"{}\+PUT\char`\"{}}, {\ttfamily \char`\"{}\+DELETE\char`\"{}}, {\ttfamily \char`\"{}\+TRACE\char`\"{}}, {\ttfamily \char`\"{}\+CONNECT\char`\"{}}, or {\ttfamily \char`\"{}\+PATCH\char`\"{}}). Additional methods can be added in the constructor with the a {\ttfamily additional\+\_\+methods} option. \\ \hline {\em path} & The path for the message (i.\+e. {\ttfamily \char`\"{}/path/resource?method\¶m=value\char`\"{}}) \\ \hline {\em headers} & An optional hash of headers to include in the message; values are converted to strings; a list is converted to a string of comma-\/separated values; headers that differ only in case will be overwritten by the last header in the hash with a matching name with a case-\/insensitive search \\ \hline {\em timeout\+\_\+ms} & the timeout in milliseconds for the socket I/O operations; 0 means use the default timeout value \\ \hline {\em getbody} & If this argument is \mbox{\hyperlink{basic_data_types_True}{True}}, then the object will try to receive a message body even if no {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header is present in the response. Use this only with broken servers that send message bodies without a {\ttfamily \char`\"{}\+Content-\/\+Length\char`\"{}} header. \\ \hline {\em info} & An optional reference to an lvalue that will be used as an output variable giving a hash of request headers and other information about the HTTP request; this hash contains the following keys\+: \begin{DoxyItemize} \item {\ttfamily accept-\/charset}\+: this key will be set to an appropriate value from any {\ttfamily \char`\"{}\+Accept-\/\+Charset\char`\"{}} header; if any of {\ttfamily \char`\"{}$\ast$\char`\"{}}, {\ttfamily \char`\"{}utf8\char`\"{}}, or {\ttfamily \char`\"{}utf-\/8\char`\"{}} are present, then this will be set to {\ttfamily \char`\"{}utf8\char`\"{}}, otherwise it will be set to the first requested character encoding in the list \item {\ttfamily charset\+:} if there is a {\ttfamily \char`\"{}charset\char`\"{}} declaration in the {\ttfamily \char`\"{}\+Content-\/\+Type\char`\"{}} header, the value is returned in this key \item {\ttfamily body-\/content-\/type}\+: the outgoing message body MIME {\ttfamily Content-\/\+Type} value \item {\ttfamily headers\+:} a hash of outgoing HTTP request headers (returned as sent, without any case conversions) \item {\ttfamily request-\/uri}\+: the request URI string sent (ex\+: {\ttfamily \char`\"{}\+GET /services/async/38.\+0/job HTTP/1.\+1\char`\"{}}) \item {\ttfamily request-\/body}\+: the raw message body in the request (before any content encoding) \item {\ttfamily response-\/body}\+: the raw message body in the response (after any content decoding) \item {\ttfamily response-\/headers}\+: a hash of incoming HTTP headers in the response with keys converted to all lower case for each header in the response message, plus the following Qore-\/provided keys\+: \begin{DoxyItemize} \item {\ttfamily http\+\_\+version\+:} the HTTP version in the response URI \item {\ttfamily status\+\_\+code\+:} the HTTP status code of the response \item {\ttfamily status\+\_\+message\+:} the HTTP status message of the response \end{DoxyItemize} \item {\ttfamily response-\/headers-\/raw}\+: a hash of raw unprocessed incoming HTTP headers \item {\ttfamily response-\/uri}\+: the HTTP response URI \end{DoxyItemize}\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} The headers received from the HTTP server with all key names converted to lower-\/case. The message body (if any) will be assigned to the value of the {\ttfamily \char`\"{}body\char`\"{}} key and the HTTP status will be assigned to the {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key. \end{DoxyReturn} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+METHOD-\/\+ERROR} & invalid/unknown HTTP method passed \\ \hline {\em HTTP-\/\+CLIENT-\/\+REDIRECT-\/\+ERROR} & invalid redirect location given by remote \\ \hline {\em HTTP-\/\+CLIENT-\/\+MAXIMUM-\/\+REDIRECTS-\/\+EXCEEDED} & maximum redirect count exceeded \\ \hline {\em HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} & unknown content encoding received or status error communicating with HTTP server (status code $<$ 100 or $>$ 299); in case of a status error the {\ttfamily \char`\"{}arg\char`\"{}} key of the exception hash will be set to a hash equal to the normal return value of this method including a {\ttfamily \char`\"{}status\+\_\+code\char`\"{}} key (giving the status code) and a {\ttfamily \char`\"{}body\char`\"{}} key (giving the message body returned by the server); note that this error is not raised for HTTP status codes indicating an error if the {\ttfamily error\+\_\+passthru} option is set to \mbox{\hyperlink{basic_data_types_True}{True}}; see the {\ttfamily error\+\_\+passthru} option in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1966daad73f8cd30da527e16618eb768}{HTTPClient\+::constructor()}} \\ \hline {\em ENCODING-\/\+CONVERSION-\/\+ERROR} & the given string could not be converted to the socket\textquotesingle{}s character encoding \\ \hline {\em SOCKET-\/\+SEND-\/\+ERROR} & There was an error sending the data \\ \hline {\em SOCKET-\/\+CLOSED} & The remote end closed the connection \\ \hline {\em SOCKET-\/\+RECV-\/\+ERROR} & There was an error receiving the data \\ \hline {\em SOCKET-\/\+TIMEOUT} & Data transmission or reception for a single \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a5f2689469e270c7a5ea8f5fb024889a3}{send()}} or \mbox{\hyperlink{class_qore_1_1_socket_adba4badd712c161df1b2da87e528ecb8}{recv()}} action exceeded the timeout period \\ \hline {\em SOCKET-\/\+SSL-\/\+ERROR} & There was an SSL error while reading data from the socket \\ \hline {\em SOCKET-\/\+HTTP-\/\+ERROR} & Invalid HTTP data was received\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} \begin{DoxyItemize} \item The {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\+: chunked\char`\"{}} header is automatically set with this method if no {\ttfamily \char`\"{}\+Transfer-\/\+Encoding\char`\"{}} header is already present \item For possible exceptions when implicitly establishing a connection, see the \mbox{\hyperlink{class_qore_1_1_socket_a7e0dc386a95c3c6a0e1cc12269d4374b}{Socket\+::connect()}} method (or \mbox{\hyperlink{class_qore_1_1_socket_a3d64c129d67687ab0e00b96b495059c5}{Socket\+::connect\+SSL()}} for secure connections) \end{DoxyItemize} \end{DoxyNote} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_httpclient_get_with_body}{HTTP GET Requests With a Message Body}} \end{DoxySeeAlso} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+10 \item Qore 0.\+9.\+3 added support for the {\ttfamily response-\/headers-\/raw} info key \end{DoxyItemize} \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aee4d57e5a86611578ef85c7cd2246092}\label{class_qore_1_1_h_t_t_p_client_aee4d57e5a86611578ef85c7cd2246092}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setAssumedEncoding@{setAssumedEncoding}} \index{setAssumedEncoding@{setAssumedEncoding}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setAssumedEncoding()}{setAssumedEncoding()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::set\+Assumed\+Encoding (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})} sets the assumed character encoding for messages from the HTTP server without any charset indicator \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setAssumedEncoding(\textcolor{stringliteral}{"{}utf-\/8"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em encoding} & the encoding to set; if empty or not present, the default {\ttfamily \char`\"{}\+ISO-\/8859-\/1\char`\"{}} will be set\\ \hline \end{DoxyParams} \begin{DoxySince}{Since} Qore 0.\+9.\+4.\+2 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a9f2e9160de50ea228613df0f4ddc4eac}\label{class_qore_1_1_h_t_t_p_client_a9f2e9160de50ea228613df0f4ddc4eac}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setConnectionPath@{setConnectionPath}} \index{setConnectionPath@{setConnectionPath}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setConnectionPath()}{setConnectionPath()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::set\+Connection\+Path (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{uri\+\_\+path }\end{DoxyParamCaption})} Overrides any connection path set in the URL. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setConnectionPath(new\_path);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a1d0fef0b049abca0d26c931c5e8f020b}{get\+Connection\+Path()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+3.\+2 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a59c32a1cb1c23f5616a57c7b349521ef}\label{class_qore_1_1_h_t_t_p_client_a59c32a1cb1c23f5616a57c7b349521ef}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setConnectTimeout@{setConnectTimeout}} \index{setConnectTimeout@{setConnectTimeout}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setConnectTimeout()}{setConnectTimeout()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Connect\+Timeout (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily -\/1} }\end{DoxyParamCaption})} Sets the connect timeout in milliseconds. \begin{DoxyParams}{Parameters} {\em timeout\+\_\+ms} & the connect timeout in milliseconds; negative numbers mean use the default system connect timeout. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 30s} = 30 seconds, etc.).\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setConnectTimeout(2m);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a7d57e49bdde9c6fa2d67013f3fb0a4c8}\label{class_qore_1_1_h_t_t_p_client_a7d57e49bdde9c6fa2d67013f3fb0a4c8}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setDefaultPath@{setDefaultPath}} \index{setDefaultPath@{setDefaultPath}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setDefaultPath()}{setDefaultPath()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Default\+Path (\begin{DoxyParamCaption}\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{path }\end{DoxyParamCaption})} Sets the default path used by the object if no path is set in the URL. \begin{DoxyParams}{Parameters} {\em path} & the default path value to set or if \mbox{\hyperlink{basic_data_types_nothing}{NOTHING}} then clears the path\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setDefaultPath();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a79ec21def4e2015d6da8b2a5d71e9b0e}\label{class_qore_1_1_h_t_t_p_client_a79ec21def4e2015d6da8b2a5d71e9b0e}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setEncoding@{setEncoding}} \index{setEncoding@{setEncoding}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setEncoding()}{setEncoding()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Encoding (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})} Sets the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding. \begin{DoxyParams}{Parameters} {\em encoding} & the string encoding for the object; any strings deserialized with this object will be tagged with this character encoding\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setEncoding(\textcolor{stringliteral}{"{}UTF-\/8"{}});} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a50b0c1fe246fe6f0d2a61bcf7f304cac}\label{class_qore_1_1_h_t_t_p_client_a50b0c1fe246fe6f0d2a61bcf7f304cac}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setEncodingPassthru@{setEncodingPassthru}} \index{setEncodingPassthru@{setEncodingPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setEncodingPassthru()}{setEncodingPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::set\+Encoding\+Passthru (\begin{DoxyParamCaption}\item[{bool}]{set = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} set the encoding passthru status \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setEncodingPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em set} & if \mbox{\hyperlink{basic_data_types_True}{True}} then message bodies received with known content encodings are not decoded but rather passed through as-\/is\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the old {\ttfamily encoding\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then message bodies received with known content encodings are not decoded but rather passed through as-\/is \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a178a903d388dbf76e78df59c3fc8cfc8}\label{class_qore_1_1_h_t_t_p_client_a178a903d388dbf76e78df59c3fc8cfc8}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setErrorPassthru@{setErrorPassthru}} \index{setErrorPassthru@{setErrorPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setErrorPassthru()}{setErrorPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::set\+Error\+Passthru (\begin{DoxyParamCaption}\item[{bool}]{set = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} set the error passthru status \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setErrorPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em set} & if \mbox{\hyperlink{basic_data_types_True}{True}} then HTTP status codes indicating errors will not cause an {\ttfamily HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} exception to be raised, rather such responses will be passed through to the caller like any other response\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the old {\ttfamily error\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then HTTP status codes indicating errors will not cause an {\ttfamily HTTP-\/\+CLIENT-\/\+RECEIVE-\/\+ERROR} exception to be raised, rather such responses will be passed through to the caller like any other response. \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_af48e59604f6e7da844c79ac958b45f6a}\label{class_qore_1_1_h_t_t_p_client_af48e59604f6e7da844c79ac958b45f6a}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setEventQueue@{setEventQueue}} \index{setEventQueue@{setEventQueue}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Event\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears any Queue object that may be set on the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object so that \mbox{\hyperlink{event_handling}{I/O events}} are no longer captured on the object. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setEventQueue();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ab882b74d8f3447c4f02d7cbb4902783b}\label{class_qore_1_1_h_t_t_p_client_ab882b74d8f3447c4f02d7cbb4902783b}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setEventQueue@{setEventQueue}} \index{setEventQueue@{setEventQueue}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setEventQueue()}{setEventQueue()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Event\+Queue (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue, }\item[{auto}]{arg, }\item[{\+\_\+\+\_\+7\+\_\+ bool}]{with\+\_\+data }\end{DoxyParamCaption})} Sets a Queue object to receive \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} and \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} events. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setEventQueue(queue);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em queue} & a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} and \mbox{\hyperlink{class_qore_1_1_socket}{Socket}} events; note that the Queue passed cannot have any maximum size set or a QUEUE-\/\+ERROR will be thrown \\ \hline {\em arg} & an argument that will be included in each event hash in the {\itshape arg} key \\ \hline {\em with\+\_\+data} & if \mbox{\hyperlink{basic_data_types_True}{True}}, then the actual raw data transferred / received is also included in the events\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em QUEUE-\/\+ERROR} & the Queue passed has a maximum size set\\ \hline \end{DoxyExceptions} \begin{DoxySeeAlso}{See also} event\+\_\+handling for more information \end{DoxySeeAlso} \begin{DoxySince}{Since} Qore 0.\+9.\+4 added the {\itshape arg} and {\itshape with\+\_\+data} options \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a123efcd92e5d648856435f3fa445d620}\label{class_qore_1_1_h_t_t_p_client_a123efcd92e5d648856435f3fa445d620}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setHTTPVersion@{setHTTPVersion}} \index{setHTTPVersion@{setHTTPVersion}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setHTTPVersion()}{setHTTPVersion()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+HTTPVersion (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{ver }\end{DoxyParamCaption})} Sets the HTTP protocol version string for headers in outgoing messages, allowed values are {\ttfamily \char`\"{}1.\+0\char`\"{}} and "{}1.\+1"{}. \begin{DoxyParams}{Parameters} {\em ver} & {\ttfamily \char`\"{}1.\+0\char`\"{}} or "{}1.\+1"{} for the HTTP protocol compliance version\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setHTTPVersion(\textcolor{stringliteral}{"{}1.1"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+VERSION-\/\+ERROR} & invalid HTTP version passed (allowed values\+: {\ttfamily \char`\"{}1.\+0\char`\"{}} and "{}1.\+1"{}) \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aea1c09e972256088465cacc56019906e}\label{class_qore_1_1_h_t_t_p_client_aea1c09e972256088465cacc56019906e}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setMaxRedirects@{setMaxRedirects}} \index{setMaxRedirects@{setMaxRedirects}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setMaxRedirects()}{setMaxRedirects()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Max\+Redirects (\begin{DoxyParamCaption}\item[{softint}]{mr = {\ttfamily 0} }\end{DoxyParamCaption})} Updates the setting for the {\ttfamily max\+\_\+redirects} value for the object (maximum number of HTTP redirects that will be processed before an exception is raised) \begin{DoxyParams}{Parameters} {\em mr} & the setting for the maximum number of HTTP redirects that will be processed before an exception is raised\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setMaxRedirects(5);} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_afbb1c7d48fc1b1dcba32e1051041bfae}{HTTPClient\+::get\+Max\+Redirects()}} to retrieve this value \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ae6d797291f0f87d5243e40d2f8ea2bb7}\label{class_qore_1_1_h_t_t_p_client_ae6d797291f0f87d5243e40d2f8ea2bb7}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setNoDelay@{setNoDelay}} \index{setNoDelay@{setNoDelay}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setNoDelay()}{setNoDelay()}} {\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+HTTPClient\+::set\+No\+Delay (\begin{DoxyParamCaption}\item[{softbool}]{b = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} Sets the {\ttfamily TCP\+\_\+\+NODELAY} setting for the object. When this setting is True, then data will be immediately sent out over the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object\textquotesingle{}s socket, when it is \mbox{\hyperlink{basic_data_types_False}{False}}, then data transmission may be delayed to be packaged with other data for the same target. Delayed data transmissions may cause problems when the sender immediately closes the socket after sending data; in this case the receiver may not get the data even though the send succeeded. Note that if no value is given to the method, the argument will be assumed to be \mbox{\hyperlink{basic_data_types_True}{True}}, and output buffering will be turned off for the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client}{HTTPClient}} object. If the socket is not connected when this call is made, then an internal flag is set and the {\ttfamily TCP\+\_\+\+NODELAY} option is enabled when the next connection is established. If the socket is connected, then if an error occurs setting the {\ttfamily TCP\+\_\+\+NODELAY} option on the socket, this method will return a non-\/zero error code; the actual error can be checked with the \mbox{\hyperlink{namespace_qore_abcf45c25ca1234fc8c54761750324cda}{errno()}} function. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setNoDelay(\textcolor{keyword}{True});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em b} & the {\ttfamily TCP\+\_\+\+NODELAY} setting for the object\\ \hline \end{DoxyParams} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a3f9632f945cdd1df380d2831e73c924b}{HTTPClient\+::get\+No\+Delay()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a2e3bd5ea66d056b0a3f69b4d0e86964e}\label{class_qore_1_1_h_t_t_p_client_a2e3bd5ea66d056b0a3f69b4d0e86964e}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setPersistent@{setPersistent}} \index{setPersistent@{setPersistent}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setPersistent()}{setPersistent()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::set\+Persistent (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} temporarily disables implicit reconnections; must be called when the server is already connected \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.connect();} \DoxyCodeLine{httpclient.setPersistent();} \end{DoxyCode} \end{DoxyParagraph} The persistent flag is automatically reset to \mbox{\hyperlink{basic_data_types_False}{False}} whenever the connection is closed; it must be called manually for every connection to turn off implicit reconnections. To turn off the persistent flag manually, call \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aeaa701096e2089dd42de81fb177730e9}{HTTPClient\+::disconnect()}} \begin{DoxySince}{Since} \mbox{\hyperlink{namespace_qore}{Qore}} 0.\+8.\+10 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ae58ff38024846050d5be3f6b36952c90}\label{class_qore_1_1_h_t_t_p_client_ae58ff38024846050d5be3f6b36952c90}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setProxySecure@{setProxySecure}} \index{setProxySecure@{setProxySecure}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setProxySecure()}{setProxySecure()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Proxy\+Secure (\begin{DoxyParamCaption}\item[{softbool}]{b = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} Sets the SSL/\+TLS flag for the next connection to the proxy. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxySecure(\textcolor{keyword}{True});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a04c2df5e6fca680874e388a093fa136a}{HTTPClient\+::is\+Proxy\+Secure()}} to check the flag \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}\label{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setProxyURL@{setProxyURL}} \index{setProxyURL@{setProxyURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setProxyURL()}{setProxyURL()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Proxy\+URL (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the new proxy URL value for the next connection. This variant of the method is equivalent to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ad7688922670e2c8795a1ee680a2d51e3}{HTTPClient\+::clear\+Proxy\+URL()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxyURL();} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a27075d22526b650fdee997932cc1b658}\label{class_qore_1_1_h_t_t_p_client_a27075d22526b650fdee997932cc1b658}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setProxyURL@{setProxyURL}} \index{setProxyURL@{setProxyURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setProxyURL()}{setProxyURL()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Proxy\+URL (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{url }\end{DoxyParamCaption})} Sets a new proxy URL value for the next connection. \begin{DoxyParams}{Parameters} {\em url} & the new proxy URL value for the next connection\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxyURL(\textcolor{stringliteral}{"{}http://user:password@proxy\_host:8080/path"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+URL-\/\+ERROR} & invalid proxy URL string; invalid authorization credentials in proxy URL (username without password or vice-\/versa) \\ \hline {\em HTTP-\/\+CLIENT-\/\+PROXY-\/\+PROTOCOL-\/\+ERROR} & unknown protocol passed in URL\\ \hline \end{DoxyExceptions} \begin{DoxyNote}{Note} URLs with UNIX sockets are generally supported in \mbox{\hyperlink{namespace_qore}{Qore}} with the following syntax\+: {\ttfamily {\bfseries{scheme\+://socket=}}}{\itshape url\+\_\+encoded\+\_\+path}{\ttfamily {\bfseries{/path}}}, where {\itshape url\+\_\+encoded\+\_\+path} is a path with URL-\/encoding as performed by \mbox{\hyperlink{group__misc__functions_ga639fba8c278c69ac4d4190ca1db19235}{encode\+\_\+url(string, True)}}; for example\+: {\ttfamily \char`\"{}http\+://socket=\%2ftmp\%socket-\/dir\%2fsocket-\/file-\/1/url/path\char`\"{}}; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well. \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_af4bccc6d03ff65bcd7e0a54c7b92e602}\label{class_qore_1_1_h_t_t_p_client_af4bccc6d03ff65bcd7e0a54c7b92e602}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setProxyUserPassword@{setProxyUserPassword}} \index{setProxyUserPassword@{setProxyUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setProxyUserPassword()}{setProxyUserPassword()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Proxy\+User\+Password (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the username and password for the next proxy connection. Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} to clear any proxy authentication information present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} This variant of the method is equivalent to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ad555d0d81c335bb51820585b98888c12}{HTTPClient\+::clear\+Proxy\+User\+Password()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxyUserPassword();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ad555d0d81c335bb51820585b98888c12}{HTTPClient\+::clear\+Proxy\+User\+Password()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_afb6865d4b0d09a03f8688a1acbe5b320}\label{class_qore_1_1_h_t_t_p_client_afb6865d4b0d09a03f8688a1acbe5b320}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setProxyUserPassword@{setProxyUserPassword}} \index{setProxyUserPassword@{setProxyUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setProxyUserPassword()}{setProxyUserPassword()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Proxy\+User\+Password (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{user, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass }\end{DoxyParamCaption})} Sets the username and password for the connection to the proxy; call after \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} to set proxy authentication information when not present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_aef070595f39138c8d0d9f20ac47b6ac0}{HTTPClient\+::set\+Proxy\+URL()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setProxyUserPassword(user, \textcolor{keywordflow}{pass});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em user} & the username to use for proxy authentication in the next HTTP connection \\ \hline {\em pass} & the password to use for proxy authentication in the next HTTP connection \\ \hline \end{DoxyParams} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aef3874b2cf110ccc2e15ce0f79071962}\label{class_qore_1_1_h_t_t_p_client_aef3874b2cf110ccc2e15ce0f79071962}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setRedirectPassthru@{setRedirectPassthru}} \index{setRedirectPassthru@{setRedirectPassthru}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setRedirectPassthru()}{setRedirectPassthru()}} {\footnotesize\ttfamily bool Qore\+::\+HTTPClient\+::set\+Redirect\+Passthru (\begin{DoxyParamCaption}\item[{bool}]{set = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} set the redirect passthru status \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setRedirectPassthru();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em set} & if \mbox{\hyperlink{basic_data_types_True}{True}} then redirect messages will be passed to the caller instead of proceessed\\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} the old {\ttfamily reddirect\+\_\+passthru} value \end{DoxyReturn} If \mbox{\hyperlink{basic_data_types_True}{True}} then redirect messages will be passed to the callers instead of proceessed \begin{DoxySince}{Since} Qore 0.\+9.\+3 \end{DoxySince} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a5d0b8c0b6fe386efb42367d81cc20e51}\label{class_qore_1_1_h_t_t_p_client_a5d0b8c0b6fe386efb42367d81cc20e51}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setSecure@{setSecure}} \index{setSecure@{setSecure}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setSecure()}{setSecure()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Secure (\begin{DoxyParamCaption}\item[{softbool}]{secure = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})} Sets the object to make a secure SSL/\+TLS connection on the next connect if the passed argument is \mbox{\hyperlink{basic_data_types_True}{True}}, or an unencrypted cleartext connection if it is \mbox{\hyperlink{basic_data_types_False}{False}}. This method overrides the default behaviour for the protocol set for the object Note that the behavior of this method when called with no argument changed in version 0.\+8.\+0; prior to version 0.\+8.\+0 calling this method with no argument would turn off secure mode; the behavior was changed to the current functionality in order to make the usage of this method consistent with other methods of the same name and to make it more logical. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setSecure(\textcolor{keyword}{True});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em secure} & if \mbox{\hyperlink{basic_data_types_True}{True}}, a SSL/\+TLS connection will be attempted on the next connection. If \mbox{\hyperlink{basic_data_types_False}{False}}, an unencrypted cleartext connection will be established \\ \hline \end{DoxyParams} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_af55851848983f0c17a0ee2d217f6c198}\label{class_qore_1_1_h_t_t_p_client_af55851848983f0c17a0ee2d217f6c198}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setTimeout@{setTimeout}} \index{setTimeout@{setTimeout}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setTimeout()}{setTimeout()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Timeout (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0} }\end{DoxyParamCaption})} Sets the default I/O timeout value in milliseconds. \begin{DoxyParams}{Parameters} {\em timeout\+\_\+ms} & 0 means immediate timeout (when reading will return data only if it is already available), and negative numbers mean never timeout. Note that like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} can be used to make the units clear (i.\+e. {\ttfamily 2m} = two minutes, etc.).\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setTimeout(2m);} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}\label{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setURL@{setURL}} \index{setURL@{setURL}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setURL()}{setURL()}} {\footnotesize\ttfamily Qore\+::\+HTTPClient\+::set\+URL (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{url }\end{DoxyParamCaption})} Sets a new URL value for the next connection. To retrieve the current URL value, use the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}{HTTPClient\+::get\+URL()}} method \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setURL(\textcolor{stringliteral}{"{}https://user:password@hostname:8080/path"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em url} & the new URL for the object\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em HTTP-\/\+CLIENT-\/\+URL-\/\+ERROR} & invalid URL string; invalid authorization credentials in URL (username without password or vice-\/versa) \\ \hline {\em HTTP-\/\+CLIENT-\/\+UNKNOWN-\/\+PROTOCOL} & unknown protocol (scheme) passed in URL\\ \hline \end{DoxyExceptions} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9a9b553de7854b86ca978a8d10c3c9dd}{HTTPClient\+::get\+URL()}} \end{DoxySeeAlso} \begin{DoxyNote}{Note} URLs with UNIX sockets are generally supported in \mbox{\hyperlink{namespace_qore}{Qore}} with the following syntax\+: {\ttfamily {\bfseries{scheme\+://socket=}}}{\itshape url\+\_\+encoded\+\_\+path}{\ttfamily {\bfseries{/path}}}, where {\itshape url\+\_\+encoded\+\_\+path} is a path with URL-\/encoding as performed by \mbox{\hyperlink{group__misc__functions_ga639fba8c278c69ac4d4190ca1db19235}{encode\+\_\+url(string, True)}}; for example\+: {\ttfamily \char`\"{}http\+://socket=\%2ftmp\%socket-\/dir\%2fsocket-\/file-\/1/url/path\char`\"{}}; this allows a filesystem path to be used in the host portion of the URL and for the URL to include a URL path as well. \end{DoxyNote} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ab612d8a6bec649e1252515b2e78d2150}\label{class_qore_1_1_h_t_t_p_client_ab612d8a6bec649e1252515b2e78d2150}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setUserPassword@{setUserPassword}} \index{setUserPassword@{setUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setUserPassword()}{setUserPassword()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+User\+Password (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Clears the username and password for the connection. Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} to clear any authentication information present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} This variant of the method is equivalent to \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9759d21c503bea0563dd8eaf6d6cfbd1}{HTTPClient\+::clear\+User\+Password()}} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setUserPassword();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a9759d21c503bea0563dd8eaf6d6cfbd1}{HTTPClient\+::clear\+User\+Password()}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_aa02efa9f178f55a45da68a84bd824c71}\label{class_qore_1_1_h_t_t_p_client_aa02efa9f178f55a45da68a84bd824c71}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setUserPassword@{setUserPassword}} \index{setUserPassword@{setUserPassword}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setUserPassword()}{setUserPassword()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+User\+Password (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{user, }\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass }\end{DoxyParamCaption})} Sets the username and password for the connection; call after \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} Call this method after calling \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} to set authentication information when not present in the URL used in \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a79d3f4dc0a39cd9afb1d30d5337e61e1}{HTTPClient\+::set\+URL()}} \begin{DoxyParams}{Parameters} {\em user} & the username to use for authentication in the next HTTP connection \\ \hline {\em pass} & the password to use for authentication in the next HTTP connection\\ \hline \end{DoxyParams} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setUserPassword(user, \textcolor{keywordflow}{pass});} \end{DoxyCode} \end{DoxyParagraph} \mbox{\Hypertarget{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}\label{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}} \index{Qore::HTTPClient@{Qore::HTTPClient}!setWarningQueue@{setWarningQueue}} \index{setWarningQueue@{setWarningQueue}!Qore::HTTPClient@{Qore::HTTPClient}} \doxysubsubsection{\texorpdfstring{setWarningQueue()}{setWarningQueue()}} {\footnotesize\ttfamily nothing Qore\+::\+HTTPClient\+::set\+Warning\+Queue (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{warning\+\_\+ms, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{warning\+\_\+bs, }\item[{Queue}]{queue, }\item[{auto}]{arg, }\item[{timeout}]{min\+\_\+ms = {\ttfamily 1s} }\end{DoxyParamCaption})} Sets a \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive socket warnings. \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{httpclient.setWarningQueue(5000, 5000, queue, \textcolor{stringliteral}{"{}socket-\/1"{}});} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxyParams}{Parameters} {\em warning\+\_\+ms} & the threshold in milliseconds for individual socket actions (send, receive, connect), if exceeded, a socket warning is placed on the warning queue with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}type\char`\"{}}\+: a string with the constant value {\ttfamily \char`\"{}\+SOCKET-\/\+OPERATION-\/\+WARNING\char`\"{}} \item {\ttfamily \char`\"{}operation\char`\"{}}\+: a string giving the operation that caused the warning (ex\+: {\ttfamily \char`\"{}connect\char`\"{}}) \item {\ttfamily \char`\"{}us\char`\"{}}\+: an integer giving the number of microseconds for the operation \item {\ttfamily \char`\"{}timeout\char`\"{}}\+: an integer giving the warning threshold in microseconds \item {\ttfamily \char`\"{}arg\char`\"{}}\+: if any {\ttfamily \char`\"{}arg\char`\"{}} argument is passed to the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}} method, it will be included in the warning hash here \end{DoxyItemize}\\ \hline {\em warning\+\_\+bs} & value in bytes per second; if any call has performance below this threshold, a socket warning is placed on the warning queue with the following keys\+: \begin{DoxyItemize} \item {\ttfamily \char`\"{}type\char`\"{}}\+: a string with the constant value {\ttfamily \char`\"{}\+SOCKET-\/\+THROUGHPUT-\/\+WARNING\char`\"{}} \item {\ttfamily \char`\"{}dir\char`\"{}}\+: either {\ttfamily \char`\"{}send\char`\"{}} or {\ttfamily \char`\"{}recv\char`\"{}} depending on the direction of the data flow \item {\ttfamily \char`\"{}bytes\char`\"{}}\+: the amount of bytes sent \item {\ttfamily \char`\"{}us\char`\"{}}\+: an integer giving the number of microseconds for the operation \item {\ttfamily \char`\"{}bytes\+\_\+sec\char`\"{}}\+: a float giving the transfer speed in bytes per second \item {\ttfamily \char`\"{}threshold\char`\"{}}\+: an integer giving the warning threshold in bytes per second \item {\ttfamily \char`\"{}arg\char`\"{}}\+: if any {\ttfamily \char`\"{}arg\char`\"{}} argument is passed to the \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_ae2aafddbf5be67012e3b57f846c4105e}{HTTPClient\+::set\+Warning\+Queue()}} method, it will be included in the warning hash here \end{DoxyItemize}\\ \hline {\em queue} & the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive warning events \\ \hline {\em arg} & an optional argument to be placed in the {\ttfamily \char`\"{}arg\char`\"{}} key in each warning hash (could be used to identify the socket for example) \\ \hline {\em min\+\_\+ms} & the minimum transfer time with a resolution of milliseconds for a transfer to be eligible for triggering a warning; transfers that take less than this period of time are not eligible for raising a warning\\ \hline \end{DoxyParams} \begin{DoxyExceptions}{Exceptions} {\em QUEUE-\/\+ERROR} & the Queue passed has a maximum size set \\ \hline {\em SOCKET-\/\+SETWARNINGQUEUE-\/\+ERROR} & at least one of {\itshape warning\+\_\+ms} and {\itshape warning\+\_\+bs} must be $>$ 0\\ \hline \end{DoxyExceptions} \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_h_t_t_p_client_a4102b502a8be8262eecea4e0a85ebe5b}{HTTPClient\+::clear\+Warning\+Queue()}} \end{DoxySeeAlso} \begin{DoxySince}{Since} \begin{DoxyItemize} \item Qore 0.\+8.\+9 \item Qore 0.\+8.\+12 the minimum threshold for a warning is a transfer of at least 1024 bytes, smaller transfers will not result in a warning \end{DoxyItemize} \end{DoxySince}