| Qore ConnectionProvider Module Reference 1.7.1

HttpConnection.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
2 // Qore HttpConnection class definition
3
4 /* HttpConnection.qc Copyright 2016 - 2022 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
29 namespace ConnectionProvider {
31
50 class HttpConnection : public AbstractConnectionWithInfo {
51
52 public:
54 const ConnectionScheme = <ConnectionSchemeInfo>{
55 "cls": Class::forName("FilesystemConnection"),
56 "options": {
57 "assume_encoding": <ConnectionOptionInfo>{
58 "type": "string",
59 "desc": "assumes the given encoding if the server does not send a `charset` value",
60 },
61 "connect_timeout": <ConnectionOptionInfo>{
62 "type": "int",
63 "desc": "connection timeout to use in milliseconds (default: 45 seconds)",
64 "default_value": 45000,
65 },
66 "error_passthru": <ConnectionOptionInfo>{
67 "type": "bool",
68 "desc": "if `True` then HTTP status codes indicating errors will not cause an "
69 "`HTTP-CLIENT-RECEIVE-ERROR` exception to be raised, rather such responses will be "
70 "passed through to the caller like any other response",
71 "default_value": False,
72 },
73 "http_version": <ConnectionOptionInfo>{
74 "type": "string",
75 "desc": "HTTP version to use (`1.0` or `1.1`, defaults to `1.1`)",
76 "default_value": "1.1",
77 },
78 "max_redirects": <ConnectionOptionInfo>{
79 "type": "int",
80 "desc": "maximum redirects to support",
81 },
82 "proxy": <ConnectionOptionInfo>{
83 "type": "string",
84 "desc": "proxy URL to use",
85 },
86 "redirect_passthru": <ConnectionOptionInfo>{
87 "type": "bool",
88 "desc": "if `True` then redirect responses will be passed to the caller instead of processed",
89 "default_value": False,
90 },
91 "ssl_cert_data": <ConnectionOptionInfo>{
92 "type": "data",
93 "desc": "the X.509 certificate data in PEM format (string) or in DER format (binary); if this "
94 "option is set, then `ssl_cert_path` is ignored",
95 },
96 "ssl_cert_path": <ConnectionOptionInfo>{
97 "type": "string",
98 "desc": "a path to an X.509 client certificate file in PEM format",
99 "subst_env_vars": True,
100 },
101 "ssl_key_password": <ConnectionOptionInfo>{
102 "type": "string",
103 "desc": "the password to the private key given with `ssl_key_path`",
104 "sensitive": True,
105 },
106 "ssl_key_data": <ConnectionOptionInfo>{
107 "type": "data",
108 "desc": "the X.509 private key data in PEM format (string) or in DER format (binary); if this "
109 "option is set, then `ssl_key_path` is ignored",
110 },
111 "ssl_key_path": <ConnectionOptionInfo>{
112 "type": "string",
113 "desc": "a path to a private key file in PEM format for the X.509 client certificate",
114 "subst_env_vars": True,
115 },
116 "ssl_verify_cert": <ConnectionOptionInfo>{
117 "type": "bool",
118 "desc": "if `True` then the server's certificate will only be accepted if it's verified",
119 "default_value": False,
120 },
121 "timeout": <ConnectionOptionInfo>{
122 "type": "int",
123 "desc": "transfer timeout to use in milliseconds (default: 45 seconds)",
124 "default_value": 45000,
125 },
126 },
127 };
128
130 const Options = map {$1: True}, keys ConnectionScheme.options;
131
133 const DefaultOptions = ...;
134
135
137
147 constructor(string name, string desc, string url, hash<auto> attributes = {}, hash<auto> options = {})
148 ;
149
150
152 string getType();
153
154
156
160 DataProvider::AbstractDataProvider getDataProvider();
161
162
164
168 bool hasDataProvider();
169
170
172
176 bool supportsPollingApi();
177
178
180
187 AbstractPollOperation startPollConnect();
188
189
191 protected:
192 setChildCapabilities();
193 public:
194
195
197
200 protected:
201 Qore::HTTPClient getImpl(bool connect = True, *hash<auto> rtopts);
202 public:
203
204
206 protected:
207 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
208 public:
209
210 };
211 }; // ConnectionProvider namespace
ConnectionProvider::AbstractConnection::desc
string desc
connection description
Definition: AbstractConnection.qc.dox.h:41
ConnectionProvider::AbstractConnection::url
string url
connection URL (potentially with password info)
Definition: AbstractConnection.qc.dox.h:44
ConnectionProvider::AbstractConnection::name
string name
connection name
Definition: AbstractConnection.qc.dox.h:38
ConnectionProvider::AbstractConnectionWithInfo
abstract base class for connections
Definition: AbstractConnectionWithInfo.qc.dox.h:32
ConnectionProvider::HttpConnection
class for HTTP connections; returns Qore::HTTPClient objects
Definition: HttpConnection.qc.dox.h:50
ConnectionProvider::HttpConnection::getDataProvider
DataProvider::AbstractDataProvider getDataProvider()
Returns an HttpDataProvider object for this connection.
ConnectionProvider::HttpConnection::getConnectionSchemeInfoImpl
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
ConnectionProvider::HttpConnection::hasDataProvider
bool hasDataProvider()
Returns True, as the connection returns a data provider with the getDataProvider() method.
ConnectionProvider::HttpConnection::ConnectionScheme
const ConnectionScheme
Connection entry info.
Definition: HttpConnection.qc.dox.h:54
ConnectionProvider::HttpConnection::constructor
constructor(string name, string desc, string url, hash< auto > attributes={}, hash< auto > options={})
Creates the HttpConnection object.
ConnectionProvider::HttpConnection::getImpl
Qore::HTTPClient getImpl(bool connect=True, *hash< auto > rtopts)
returns an Qore::HTTPClient object
ConnectionProvider::HttpConnection::getType
string getType()
Returns "http".
ConnectionProvider::HttpConnection::Options
const Options
HttpConnection object connection options.
Definition: HttpConnection.qc.dox.h:130
ConnectionProvider::HttpConnection::startPollConnect
AbstractPollOperation startPollConnect()
Called to start the connection if the connection supports the polling API.
ConnectionProvider::HttpConnection::supportsPollingApi
bool supportsPollingApi()
returns True, since this connection type supports the Qore Socket-based polling API
ConnectionProvider::HttpConnection::setChildCapabilities
setChildCapabilities()
Sets child data provider capabilities.
ConnectionProvider::HttpConnection::DefaultOptions
const DefaultOptions
HttpConnection default options.
Definition: HttpConnection.qc.dox.h:133
Qore::HTTPClient
True
const True
False
const False
ConnectionProvider
The ConnectionProvider namespace.
Definition: AbstractConnection.qc.dox.h:28
ConnectionProvider::ConnectionOptionInfo
Connection option information.
Definition: ConnectionSchemeCache.qc.dox.h:38
ConnectionProvider::ConnectionSchemeInfo
Connection provider information.
Definition: ConnectionSchemeCache.qc.dox.h:59