Mercurial > hg > orthanc
comparison OrthancFramework/Sources/HttpServer/HttpToolbox.cpp @ 4327:9684a690ca63
fix link errors on wasm unit tests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Nov 2020 20:53:21 +0100 |
parents | 83c5bd439fcc |
children | 9dc0e42f868b |
comparison
equal
deleted
inserted
replaced
4326:83c5bd439fcc | 4327:9684a690ca63 |
---|---|
21 | 21 |
22 | 22 |
23 #include "../PrecompiledHeaders.h" | 23 #include "../PrecompiledHeaders.h" |
24 #include "HttpToolbox.h" | 24 #include "HttpToolbox.h" |
25 | 25 |
26 #include "HttpOutput.h" | |
27 #include "StringHttpOutput.h" | |
28 | |
26 #include <stdio.h> | 29 #include <stdio.h> |
27 #include <string.h> | 30 #include <string.h> |
28 #include <iostream> | 31 #include <iostream> |
29 | 32 |
30 #include "HttpOutput.h" | |
31 #include "StringHttpOutput.h" | |
32 | |
33 | 33 |
34 static const char* LOCALHOST = "127.0.0.1"; | 34 static const char* LOCALHOST = "127.0.0.1"; |
35 | |
36 | 35 |
37 | 36 |
38 namespace Orthanc | 37 namespace Orthanc |
39 { | 38 { |
40 static void SplitGETNameValue(IHttpHandler::GetArguments& result, | 39 static void SplitGETNameValue(IHttpHandler::GetArguments& result, |
186 compiled[source[i].first] = source[i].second; | 185 compiled[source[i].first] = source[i].second; |
187 } | 186 } |
188 } | 187 } |
189 | 188 |
190 | 189 |
191 #if ORTHANC_SANDBOXED != 1 | |
192 bool HttpToolbox::SimpleGet(std::string& result, | 190 bool HttpToolbox::SimpleGet(std::string& result, |
193 IHttpHandler& handler, | 191 IHttpHandler& handler, |
194 RequestOrigin origin, | 192 RequestOrigin origin, |
195 const std::string& uri, | 193 const std::string& uri, |
196 const IHttpHandler::Arguments& httpHeaders) | 194 const IHttpHandler::Arguments& httpHeaders) |
211 else | 209 else |
212 { | 210 { |
213 return false; | 211 return false; |
214 } | 212 } |
215 } | 213 } |
216 #endif | 214 |
217 | 215 |
218 | |
219 #if ORTHANC_SANDBOXED != 1 | |
220 static bool SimplePostOrPut(std::string& result, | 216 static bool SimplePostOrPut(std::string& result, |
221 IHttpHandler& handler, | 217 IHttpHandler& handler, |
222 RequestOrigin origin, | 218 RequestOrigin origin, |
223 HttpMethod method, | 219 HttpMethod method, |
224 const std::string& uri, | 220 const std::string& uri, |
243 else | 239 else |
244 { | 240 { |
245 return false; | 241 return false; |
246 } | 242 } |
247 } | 243 } |
248 #endif | 244 |
249 | 245 |
250 | |
251 #if ORTHANC_SANDBOXED != 1 | |
252 bool HttpToolbox::SimplePost(std::string& result, | 246 bool HttpToolbox::SimplePost(std::string& result, |
253 IHttpHandler& handler, | 247 IHttpHandler& handler, |
254 RequestOrigin origin, | 248 RequestOrigin origin, |
255 const std::string& uri, | 249 const std::string& uri, |
256 const void* bodyData, | 250 const void* bodyData, |
257 size_t bodySize, | 251 size_t bodySize, |
258 const IHttpHandler::Arguments& httpHeaders) | 252 const IHttpHandler::Arguments& httpHeaders) |
259 { | 253 { |
260 return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders); | 254 return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders); |
261 } | 255 } |
262 #endif | 256 |
263 | 257 |
264 | |
265 #if ORTHANC_SANDBOXED != 1 | |
266 bool HttpToolbox::SimplePut(std::string& result, | 258 bool HttpToolbox::SimplePut(std::string& result, |
267 IHttpHandler& handler, | 259 IHttpHandler& handler, |
268 RequestOrigin origin, | 260 RequestOrigin origin, |
269 const std::string& uri, | 261 const std::string& uri, |
270 const void* bodyData, | 262 const void* bodyData, |
271 size_t bodySize, | 263 size_t bodySize, |
272 const IHttpHandler::Arguments& httpHeaders) | 264 const IHttpHandler::Arguments& httpHeaders) |
273 { | 265 { |
274 return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders); | 266 return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders); |
275 } | 267 } |
276 #endif | 268 |
277 | 269 |
278 | |
279 #if ORTHANC_SANDBOXED != 1 | |
280 bool HttpToolbox::SimpleDelete(IHttpHandler& handler, | 270 bool HttpToolbox::SimpleDelete(IHttpHandler& handler, |
281 RequestOrigin origin, | 271 RequestOrigin origin, |
282 const std::string& uri, | 272 const std::string& uri, |
283 const IHttpHandler::Arguments& httpHeaders) | 273 const IHttpHandler::Arguments& httpHeaders) |
284 { | 274 { |
291 HttpOutput http(stream, false /* no keep alive */); | 281 HttpOutput http(stream, false /* no keep alive */); |
292 | 282 |
293 return handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Delete, curi, | 283 return handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Delete, curi, |
294 httpHeaders, getArguments, NULL /* no body for DELETE */, 0); | 284 httpHeaders, getArguments, NULL /* no body for DELETE */, 0); |
295 } | 285 } |
296 #endif | |
297 } | 286 } |