Mercurial > hg > orthanc
comparison Core/HttpServer/HttpToolbox.cpp @ 1780:94990da8710e
OrthancPluginRestApiGet2
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 13 Nov 2015 15:06:45 +0100 |
parents | 3232f1c995a5 |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1779:c24dac8c1d4e | 1780:94990da8710e |
---|---|
199 | 199 |
200 | 200 |
201 bool HttpToolbox::SimpleGet(std::string& result, | 201 bool HttpToolbox::SimpleGet(std::string& result, |
202 IHttpHandler& handler, | 202 IHttpHandler& handler, |
203 RequestOrigin origin, | 203 RequestOrigin origin, |
204 const std::string& uri) | 204 const std::string& uri, |
205 { | 205 const IHttpHandler::Arguments& httpHeaders) |
206 IHttpHandler::Arguments headers; // No HTTP header | 206 { |
207 | |
208 UriComponents curi; | 207 UriComponents curi; |
209 IHttpHandler::GetArguments getArguments; | 208 IHttpHandler::GetArguments getArguments; |
210 ParseGetQuery(curi, getArguments, uri.c_str()); | 209 ParseGetQuery(curi, getArguments, uri.c_str()); |
211 | 210 |
212 StringHttpOutput stream; | 211 StringHttpOutput stream; |
213 HttpOutput http(stream, false /* no keep alive */); | 212 HttpOutput http(stream, false /* no keep alive */); |
214 | 213 |
215 if (handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Get, curi, | 214 if (handler.Handle(http, origin, LOCALHOST, "", HttpMethod_Get, curi, |
216 headers, getArguments, NULL /* no body for GET */, 0)) | 215 httpHeaders, getArguments, NULL /* no body for GET */, 0)) |
217 { | 216 { |
218 stream.GetOutput(result); | 217 stream.GetOutput(result); |
219 return true; | 218 return true; |
220 } | 219 } |
221 else | 220 else |
222 { | 221 { |
223 return false; | 222 return false; |
224 } | 223 } |
224 } | |
225 | |
226 | |
227 bool HttpToolbox::SimpleGet(std::string& result, | |
228 IHttpHandler& handler, | |
229 RequestOrigin origin, | |
230 const std::string& uri) | |
231 { | |
232 IHttpHandler::Arguments headers; // No HTTP header | |
233 return SimpleGet(result, handler, origin, uri, headers); | |
225 } | 234 } |
226 | 235 |
227 | 236 |
228 static bool SimplePostOrPut(std::string& result, | 237 static bool SimplePostOrPut(std::string& result, |
229 IHttpHandler& handler, | 238 IHttpHandler& handler, |