Qore ConnectionProvider Module Reference 1.9.2
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 "error_passthru": <ConnectionOptionInfo>{
72 "type": "bool",
73 "desc": "if `True` then HTTP status codes indicating errors will not cause an "
74 "`HTTP-CLIENT-RECEIVE-ERROR` exception to be raised, rather such responses will be "
75 "passed through to the caller like any other response",
76 "default_value": False,
77 },
78 "headers": <ConnectionOptionInfo>{
79 "type": "hash",
80 "desc": "headers to add in each outgoing request",
81 },
82 "http_version": <ConnectionOptionInfo>{
83 "type": "string",
84 "desc": "HTTP version to use (`1.0` or `1.1`, defaults to `1.1`)",
85 "default_value": "1.1",
86 },
87 "max_redirects": <ConnectionOptionInfo>{
88 "type": "int",
89 "desc": "maximum redirects to support",
90 },
91 "pre_encoded_urls": <ConnectionOptionInfo>{
92 "type": "bool",
93 "desc": "if `true` then all URI paths in URLs are assumed to be already "
94 "[percent encoded](https://en.wikipedia.org/wiki/Percent-encoding); if this flag is set and "
95 "any unencoded characters are sent in a URL with a new request, an exception is raised",
96 },
97 "proxy": <ConnectionOptionInfo>{
98 "type": "string",
99 "desc": "proxy URL to use",
100 },
101 "redirect_passthru": <ConnectionOptionInfo>{
102 "type": "bool",
103 "desc": "if `True` then redirect responses will be passed to the caller instead of processed",
104 "default_value": False,
105 },
106 "ssl_cert_data": <ConnectionOptionInfo>{
107 "type": "data",
108 "desc": "the X.509 certificate data in PEM format (string) or in DER format (binary); if this "
109 "option is set, then `ssl_cert_path` is ignored",
110 },
111 "ssl_cert_path": <ConnectionOptionInfo>{
112 "type": "string",
113 "desc": "a path to an X.509 client certificate file in PEM format",
114 "subst_env_vars": True,
115 },
116 "ssl_key_password": <ConnectionOptionInfo>{
117 "type": "string",
118 "desc": "the password to the private key given with `ssl_key_path`",
119 "sensitive": True,
120 },
121 "ssl_key_data": <ConnectionOptionInfo>{
122 "type": "data",
123 "desc": "the X.509 private key data in PEM format (string) or in DER format (binary); if this "
124 "option is set, then `ssl_key_path` is ignored",
125 },
126 "ssl_key_path": <ConnectionOptionInfo>{
127 "type": "string",
128 "desc": "a path to a private key file in PEM format for the X.509 client certificate",
129 "subst_env_vars": True,
130 },
131 "ssl_verify_cert": <ConnectionOptionInfo>{
132 "type": "bool",
133 "desc": "if `True` then the server's certificate will only be accepted if it's verified",
134 "default_value": False,
135 },
136 "timeout": <ConnectionOptionInfo>{
137 "type": "int",
138 "desc": "transfer timeout to use in milliseconds (default: 45 seconds)",
139 "default_value": 45000,
140 },
141 },
142 };
143
145 const Options = map {$1: True}, keys ConnectionScheme.options;
146
148
158 constructor(string name, string desc, string url, hash<auto> attributes = {}, hash<auto> options = {})
159 ;
160
161
163 string getType();
164
165
167
172
173
175
180
181
183
188
189
191
199
200
202protected:
204public:
205
206
208
211protected:
212 Qore::HTTPClient getImpl(bool connect = True, *hash<auto> rtopts);
213public:
214
215
217protected:
218 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
219public:
220
221};
222}; // 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:145
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
Connection option information.
Definition: ConnectionSchemeCache.qc.dox.h:38
Connection provider information.
Definition: ConnectionSchemeCache.qc.dox.h:62