Qore ConnectionProvider Module Reference 1.11
Loading...
Searching...
No Matches
HttpConnection.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
2// Qore HttpConnection class definition
3
4/* HttpConnection.qc Copyright 2016 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25
27
29namespace ConnectionProvider {
31
56
57public:
60 "cls": Class::forName("HttpConnection"),
61 "options": {
62 "assume_encoding": <ConnectionOptionInfo>{
63 "type": "string",
64 "desc": "assumes the given encoding if the server does not send a `charset` value",
65 },
66 "connect_timeout": <ConnectionOptionInfo>{
67 "type": "int",
68 "desc": "connection timeout to use in milliseconds (default: 45 seconds)",
69 "default_value": 45000,
70 },
71 "encode_chars": <ConnectionOptionInfo>{
72 "type": "string",
73 "desc": "A set of additional characters to subject to percent encoding in URLs",
74 },
75 "error_passthru": <ConnectionOptionInfo>{
76 "type": "bool",
77 "desc": "if `True` then HTTP status codes indicating errors will not cause an "
78 "`HTTP-CLIENT-RECEIVE-ERROR` exception to be raised, rather such responses will be "
79 "passed through to the caller like any other response",
80 "default_value": False,
81 },
82 "headers": <ConnectionOptionInfo>{
83 "type": "hash",
84 "desc": "headers to add in each outgoing request",
85 },
86 "http_version": <ConnectionOptionInfo>{
87 "type": "string",
88 "desc": "HTTP version to use (`1.0` or `1.1`, defaults to `1.1`)",
89 "default_value": "1.1",
90 "allowed_values": (
92 "value": "1.0",
93 "desc": "For HTTP 1.0",
94 },
96 "value": "1.1",
97 "desc": "For HTTP 1.1",
98 },
99 ),
100 },
101 "max_redirects": <ConnectionOptionInfo>{
102 "type": "int",
103 "desc": "maximum redirects to support",
104 },
105 "pre_encoded_urls": <ConnectionOptionInfo>{
106 "type": "bool",
107 "desc": "if `true` then all URI paths in URLs are assumed to be already "
108 "[percent encoded](https://en.wikipedia.org/wiki/Percent-encoding); if this flag is set and "
109 "any unencoded characters are sent in a URL with a new request, an exception is raised",
110 },
111 "proxy": <ConnectionOptionInfo>{
112 "type": "string",
113 "desc": "proxy URL to use",
114 },
115 "redirect_passthru": <ConnectionOptionInfo>{
116 "type": "bool",
117 "desc": "if `True` then redirect responses will be passed to the caller instead of processed",
118 "default_value": False,
119 },
120 "ssl_cert_data": <ConnectionOptionInfo>{
121 "type": "data",
122 "desc": "the X.509 certificate data in PEM format (string) or in DER format (binary); if this "
123 "option is set, then `ssl_cert_path` is ignored",
124 },
125 "ssl_cert_path": <ConnectionOptionInfo>{
126 "type": "string",
127 "desc": "a path to an X.509 client certificate file in PEM format",
128 "subst_env_vars": True,
129 },
130 "ssl_key_password": <ConnectionOptionInfo>{
131 "type": "string",
132 "desc": "the password to the private key given with `ssl_key_path`",
133 "sensitive": True,
134 },
135 "ssl_key_data": <ConnectionOptionInfo>{
136 "type": "data",
137 "desc": "the X.509 private key data in PEM format (string) or in DER format (binary); if this "
138 "option is set, then `ssl_key_path` is ignored",
139 },
140 "ssl_key_path": <ConnectionOptionInfo>{
141 "type": "string",
142 "desc": "a path to a private key file in PEM format for the X.509 client certificate",
143 "subst_env_vars": True,
144 },
145 "ssl_verify_cert": <ConnectionOptionInfo>{
146 "type": "bool",
147 "desc": "if `True` then the server's certificate will only be accepted if it's verified",
148 "default_value": False,
149 },
150 "timeout": <ConnectionOptionInfo>{
151 "type": "int",
152 "desc": "transfer timeout to use in milliseconds (default: 45 seconds)",
153 "default_value": 45000,
154 },
155 },
156 };
157
159 const Options = map {$1: True}, keys ConnectionScheme.options;
160
162
172 constructor(string name, string desc, string url, hash<auto> attributes = {}, hash<auto> options = {})
173 ;
174
175
177 string getType();
178
179
181
186
187
189
194
195
197
202
203
205
213
214
216protected:
218public:
219
220
222
225protected:
226 Qore::HTTPClient getImpl(bool connect = True, *hash<auto> rtopts);
227public:
228
229
231protected:
232 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
233public:
234
235};
236}; // ConnectionProvider namespace
string desc
connection description
Definition: AbstractConnection.qc.dox.h:41
string url
connection URL (potentially with password info)
Definition: AbstractConnection.qc.dox.h:44
string name
connection name
Definition: AbstractConnection.qc.dox.h:38
abstract base class for connections
Definition: AbstractConnectionWithInfo.qc.dox.h:32
class for HTTP connections; returns Qore::HTTPClient objects
Definition: HttpConnection.qc.dox.h:55
DataProvider::AbstractDataProvider getDataProvider()
Returns an HttpDataProvider object for this connection.
bool hasDataProvider()
Returns True, as the connection returns a data provider with the getDataProvider() method.
const ConnectionScheme
Connection entry info.
Definition: HttpConnection.qc.dox.h:59
constructor(string name, string desc, string url, hash< auto > attributes={}, hash< auto > options={})
Creates the HttpConnection object.
Qore::HTTPClient getImpl(bool connect=True, *hash< auto > rtopts)
returns an Qore::HTTPClient object
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
string getType()
Returns "http".
const Options
HttpConnection object connection options.
Definition: HttpConnection.qc.dox.h:159
bool supportsPollingApi()
returns True, since this connection type supports the Qore Socket-based polling API
setChildCapabilities()
Sets child data provider capabilities.
Qore::AbstractPollOperation startPollConnect()
Called to start the connection if the connection supports the polling API.
The ConnectionProvider namespace.
Definition: AbstractConnection.qc.dox.h:28
Allowed value hash.
Definition: ConnectionSchemeCache.qc.dox.h:29
Connection option information.
Definition: ConnectionSchemeCache.qc.dox.h:38
Connection provider information.
Definition: ConnectionSchemeCache.qc.dox.h:62