| Qore FileLocationHandler Module Reference 2.1

FileLocationHandlerHttp.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
4 /* FileLocationHandlerHttp Copyright 2021 - 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
26 namespace FileLocationHandler {
28 class FileLocationHandlerHttp : public AbstractFileLocationHandler {
29
30 public:
32
34 const HttpClientLocationOpts = {
35 "connect_timeout": <FileHandlerOptionInfo>{
36 "type": "int",
37 "desc": "connstion timeout in milliseconds",
38 },
39 "encoding": <FileHandlerOptionInfo>{
40 "type": "string",
41 "desc": "the string encoding for any strings returned or sent",
42 },
43 "encoding_passthru": <FileHandlerOptionInfo>{
44 "type": "bool",
45 "desc": "do not decode known content-encodings but rather pass the body through as-is",
46 },
47 "error_passthru": <FileHandlerOptionInfo>{
48 "type": "bool",
49 "desc": "HTTP status codes indicating errors will not cause an `HTTP-CLIENT-RECEIVE-ERROR` exception "
50 "to be raised",
51 },
52 "http_version": <FileHandlerOptionInfo>{
53 "type": "string",
54 "desc": "Either `1.0` or `1.1` for the claimed HTTP protocol version compliancy in outgoing message "
55 "headers",
56 },
57 "method": <FileHandlerOptionInfo>{
58 "type": "string",
59 "desc": "the HTTP method to use; if not given then `GET` is used for reads, and `POST` is used for "
60 "writes",
61 },
62 "proxy": <FileHandlerOptionInfo>{
63 "type": "string",
64 "desc": "The proxy URL for connecting through a proxy",
65 },
66 "redirect_passthru": <FileHandlerOptionInfo>{
67 "type": "bool",
68 "desc": "redirect responses will be passed to the caller instead of folllowed",
69 },
70 "ssl_cert_data": <FileHandlerOptionInfo>{
71 "type": "data",
72 "desc": "the X.509 certificate data in PEM format (string) or in DER format (binary); if this "
73 "option is set, then `ssl_cert_path` is ignored",
74 },
75 "ssl_cert_path": <FileHandlerOptionInfo>{
76 "type": "string",
77 "desc": "a path to an X.509 client certificate file in PEM format; if this option is used, then the "
78 "calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
79 "checked at runtime",
80 },
81 "ssl_key_data": <FileHandlerOptionInfo>{
82 "type": "data",
83 "desc": "the X.509 private key data in PEM format (string) or in DER format (binary); if this "
84 "option is set, then `ssl_key_path` is ignored",
85 },
86 "ssl_key_path": <FileHandlerOptionInfo>{
87 "type": "string",
88 "desc": "a path to a private key file in PEM format; if this option is used, then the "
89 "calling context must not be restricted with sandbox restriction `PO_NO_FILESYSTEM` which is "
90 "checked at runtime",
91 },
92 "ssl_key_password": <FileHandlerOptionInfo>{
93 "type": "string",
94 "desc": "the password to the private key given with `ssl_key_path`",
95 },
96 "ssl_verify_cert": <FileHandlerOptionInfo>{
97 "type": "bool",
98 "desc": "the server's certificate will only be accepted if it's verified",
99 },
100 "timeout": <FileHandlerOptionInfo>{
101 "type": "int",
102 "desc": "I/O timeout in milliseconds",
103 },
104 };
105
107
115 protected:
116 string getTextFileImpl(string scheme, string location, *hash<auto> opts);
117 public:
118
119
121
129 protected:
130 binary getBinaryFileImpl(string scheme, string location, *hash<auto> opts);
131 public:
132
133
135
141 protected:
142 Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash<auto> opts);
143 public:
144
145
147
153 protected:
154 Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash<auto> opts);
155 public:
156
157
159
164 protected:
165 writeFileImpl(string scheme, string location, data contents, *hash<auto> opts);
166 public:
167
168
170
182 protected:
183 OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash<auto> opts);
184 public:
185
186
188
190 protected:
191 hash<string, hash<FileHandlerOptionInfo>> getReadOptionsImpl();
192 public:
193
194
196
198 protected:
199 hash<string, hash<FileHandlerOptionInfo>> getWriteOptionsImpl();
200 public:
201
202
204 protected:
205 HTTPClient getHttpClient(string scheme, string location, *hash<auto> opts, reference<string> path);
206 public:
207
208 };
209 };
FileLocationHandler::AbstractFileLocationHandler
The abstract file location handler class.
Definition: FileLocationHandler.qc.dox.h:43
FileLocationHandler::FileLocationHandlerHttp
The class for handling file locations.
Definition: FileLocationHandlerHttp.qc.dox.h:28
FileLocationHandler::FileLocationHandlerHttp::getBinaryFileImpl
binary getBinaryFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerHttp::getStreamReaderImpl
Qore::StreamReader getStreamReaderImpl(string scheme, string location, *hash< auto > opts)
Returns a stream reader for the file's data at the given location.
FileLocationHandler::FileLocationHandlerHttp::writeFileImpl
writeFileImpl(string scheme, string location, data contents, *hash< auto > opts)
Writes data to a file at the given location.
FileLocationHandler::FileLocationHandlerHttp::getHttpClient
HTTPClient getHttpClient(string scheme, string location, *hash< auto > opts, reference< string > path)
Returns an HTTP client for the given location.
FileLocationHandler::FileLocationHandlerHttp::getTextFileImpl
string getTextFileImpl(string scheme, string location, *hash< auto > opts)
Retrieves a text file from the given location.
FileLocationHandler::FileLocationHandlerHttp::HttpClientLocationOpts
const HttpClientLocationOpts
Valid HTTP location options.
Definition: FileLocationHandlerHttp.qc.dox.h:34
FileLocationHandler::FileLocationHandlerHttp::getWriteOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getWriteOptionsImpl()
Gets supported write options.
FileLocationHandler::FileLocationHandlerHttp::getBinaryStreamImpl
Qore::InputStream getBinaryStreamImpl(string scheme, string location, *hash< auto > opts)
Retrieves a binary file from the given location.
FileLocationHandler::FileLocationHandlerHttp::getReadOptionsImpl
hash< string, hash< FileHandlerOptionInfo > > getReadOptionsImpl()
Gets supported read options.
FileLocationHandler::FileLocationHandlerHttp::getOutputStreamImpl
OutputStreamWrapper getOutputStreamImpl(string scheme, string location, *hash< auto > opts)
Returns an output stream for writing data to the given location.
FileLocationHandler::OutputStreamWrapper
The abstract file location handler class.
Definition: OutputStramWrapper.qc.dox.h:28
Qore::InputStream
Qore::StreamReader
binary
binary binary()
FileLocationHandler
Contains all public definitions in the FileLocationHandler module.
Definition: FileLocationHandler.qc.dox.h:26
FileLocationHandler::FileHandlerOptionInfo
File handler option info.
Definition: FileLocationHandler.qc.dox.h:28