Mercurial > hg > orthanc
comparison OrthancFramework/Sources/HttpClient.h @ 4297:785a2713323e
abi continued
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 05 Nov 2020 17:20:49 +0100 |
parents | bf7b9edf6b81 |
children | 3af1d763763a |
comparison
equal
deleted
inserted
replaced
4296:3b70a2e6a06c | 4297:785a2713323e |
---|---|
125 HttpClient(const WebServiceParameters& service, | 125 HttpClient(const WebServiceParameters& service, |
126 const std::string& uri); | 126 const std::string& uri); |
127 | 127 |
128 ~HttpClient(); | 128 ~HttpClient(); |
129 | 129 |
130 void SetUrl(const char* url) | 130 void SetUrl(const char* url); |
131 { | 131 |
132 url_ = std::string(url); | 132 void SetUrl(const std::string& url); |
133 } | 133 |
134 | 134 const std::string& GetUrl() const; |
135 void SetUrl(const std::string& url) | 135 |
136 { | 136 void SetMethod(HttpMethod method); |
137 url_ = url; | 137 |
138 } | 138 HttpMethod GetMethod() const; |
139 | 139 |
140 const std::string& GetUrl() const | 140 void SetTimeout(long seconds); |
141 { | 141 |
142 return url_; | 142 long GetTimeout() const; |
143 } | |
144 | |
145 void SetMethod(HttpMethod method) | |
146 { | |
147 method_ = method; | |
148 } | |
149 | |
150 HttpMethod GetMethod() const | |
151 { | |
152 return method_; | |
153 } | |
154 | |
155 void SetTimeout(long seconds) | |
156 { | |
157 timeout_ = seconds; | |
158 } | |
159 | |
160 long GetTimeout() const | |
161 { | |
162 return timeout_; | |
163 } | |
164 | 143 |
165 void SetBody(const std::string& data); | 144 void SetBody(const std::string& data); |
166 | 145 |
167 std::string& GetBody() | 146 std::string& GetBody(); |
168 { | 147 |
169 return body_; | 148 const std::string& GetBody() const; |
170 } | |
171 | |
172 const std::string& GetBody() const | |
173 { | |
174 return body_; | |
175 } | |
176 | 149 |
177 void SetBody(IRequestBody& body); | 150 void SetBody(IRequestBody& body); |
178 | 151 |
179 void ClearBody(); | 152 void ClearBody(); |
180 | 153 |
181 void SetVerbose(bool isVerbose); | 154 void SetVerbose(bool isVerbose); |
182 | 155 |
183 bool IsVerbose() const | 156 bool IsVerbose() const; |
184 { | |
185 return isVerbose_; | |
186 } | |
187 | 157 |
188 void AddHeader(const std::string& key, | 158 void AddHeader(const std::string& key, |
189 const std::string& value); | 159 const std::string& value); |
190 | 160 |
191 void ClearHeaders(); | 161 void ClearHeaders(); |
192 | 162 |
193 bool Apply(IAnswer& answer); | 163 bool Apply(IAnswer& answer); |
194 | 164 |
195 bool Apply(std::string& answerBody) | 165 bool Apply(std::string& answerBody); |
196 { | 166 |
197 return ApplyInternal(answerBody, NULL); | 167 bool Apply(Json::Value& answerBody); |
198 } | |
199 | |
200 bool Apply(Json::Value& answerBody) | |
201 { | |
202 return ApplyInternal(answerBody, NULL); | |
203 } | |
204 | 168 |
205 bool Apply(std::string& answerBody, | 169 bool Apply(std::string& answerBody, |
206 HttpHeaders& answerHeaders) | 170 HttpHeaders& answerHeaders); |
207 { | |
208 return ApplyInternal(answerBody, &answerHeaders); | |
209 } | |
210 | 171 |
211 bool Apply(Json::Value& answerBody, | 172 bool Apply(Json::Value& answerBody, |
212 HttpHeaders& answerHeaders) | 173 HttpHeaders& answerHeaders); |
213 { | 174 |
214 return ApplyInternal(answerBody, &answerHeaders); | 175 HttpStatus GetLastStatus() const; |
215 } | |
216 | |
217 HttpStatus GetLastStatus() const | |
218 { | |
219 return lastStatus_; | |
220 } | |
221 | 176 |
222 void SetCredentials(const char* username, | 177 void SetCredentials(const char* username, |
223 const char* password); | 178 const char* password); |
224 | 179 |
225 void SetProxy(const std::string& proxy) | 180 void SetProxy(const std::string& proxy); |
226 { | 181 |
227 proxy_ = proxy; | 182 void SetHttpsVerifyPeers(bool verify); |
228 } | 183 |
229 | 184 bool IsHttpsVerifyPeers() const; |
230 void SetHttpsVerifyPeers(bool verify) | 185 |
231 { | 186 void SetHttpsCACertificates(const std::string& certificates); |
232 verifyPeers_ = verify; | 187 |
233 } | 188 const std::string& GetHttpsCACertificates() const; |
234 | |
235 bool IsHttpsVerifyPeers() const | |
236 { | |
237 return verifyPeers_; | |
238 } | |
239 | |
240 void SetHttpsCACertificates(const std::string& certificates) | |
241 { | |
242 caCertificates_ = certificates; | |
243 } | |
244 | |
245 const std::string& GetHttpsCACertificates() const | |
246 { | |
247 return caCertificates_; | |
248 } | |
249 | 189 |
250 void SetClientCertificate(const std::string& certificateFile, | 190 void SetClientCertificate(const std::string& certificateFile, |
251 const std::string& certificateKeyFile, | 191 const std::string& certificateKeyFile, |
252 const std::string& certificateKeyPassword); | 192 const std::string& certificateKeyPassword); |
253 | 193 |
254 void SetPkcs11Enabled(bool enabled) | 194 void SetPkcs11Enabled(bool enabled); |
255 { | 195 |
256 pkcs11Enabled_ = enabled; | 196 bool IsPkcs11Enabled() const; |
257 } | 197 |
258 | 198 const std::string& GetClientCertificateFile() const; |
259 bool IsPkcs11Enabled() const | 199 |
260 { | 200 const std::string& GetClientCertificateKeyFile() const; |
261 return pkcs11Enabled_; | 201 |
262 } | 202 const std::string& GetClientCertificateKeyPassword() const; |
263 | 203 |
264 const std::string& GetClientCertificateFile() const | 204 void SetConvertHeadersToLowerCase(bool lowerCase); |
265 { | 205 |
266 return clientCertificateFile_; | 206 bool IsConvertHeadersToLowerCase() const; |
267 } | 207 |
268 | 208 void SetRedirectionFollowed(bool follow); |
269 const std::string& GetClientCertificateKeyFile() const | 209 |
270 { | 210 bool IsRedirectionFollowed() const; |
271 return clientCertificateKeyFile_; | |
272 } | |
273 | |
274 const std::string& GetClientCertificateKeyPassword() const | |
275 { | |
276 return clientCertificateKeyPassword_; | |
277 } | |
278 | |
279 void SetConvertHeadersToLowerCase(bool lowerCase) | |
280 { | |
281 headersToLowerCase_ = lowerCase; | |
282 } | |
283 | |
284 bool IsConvertHeadersToLowerCase() const | |
285 { | |
286 return headersToLowerCase_; | |
287 } | |
288 | |
289 void SetRedirectionFollowed(bool follow) | |
290 { | |
291 redirectionFollowed_ = follow; | |
292 } | |
293 | |
294 bool IsRedirectionFollowed() const | |
295 { | |
296 return redirectionFollowed_; | |
297 } | |
298 | 211 |
299 static void GlobalInitialize(); | 212 static void GlobalInitialize(); |
300 | 213 |
301 static void GlobalFinalize(); | 214 static void GlobalFinalize(); |
302 | 215 |