comparison Core/HttpServer/HttpToolbox.cpp @ 1446:8dc80ba768aa

refactoring: IHttpHandler does not use std::string to hold the request body
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Jul 2015 13:16:12 +0200
parents b2b09a3dbd8e
children 5ba7471780ae
comparison
equal deleted inserted replaced
1445:d26c8a93d05a 1446:8dc80ba768aa
197 bool HttpToolbox::SimpleGet(std::string& output, 197 bool HttpToolbox::SimpleGet(std::string& output,
198 IHttpHandler& handler, 198 IHttpHandler& handler,
199 const std::string& uri) 199 const std::string& uri)
200 { 200 {
201 IHttpHandler::Arguments headers; // No HTTP header 201 IHttpHandler::Arguments headers; // No HTTP header
202 std::string body; // No body for a GET request
203 202
204 UriComponents curi; 203 UriComponents curi;
205 IHttpHandler::GetArguments getArguments; 204 IHttpHandler::GetArguments getArguments;
206 ParseGetQuery(curi, getArguments, uri.c_str()); 205 ParseGetQuery(curi, getArguments, uri.c_str());
207 206
208 StringHttpOutput stream; 207 StringHttpOutput stream;
209 HttpOutput http(stream, false /* no keep alive */); 208 HttpOutput http(stream, false /* no keep alive */);
210 209
211 if (handler.Handle(http, HttpMethod_Get, curi, headers, getArguments, body)) 210 if (handler.Handle(http, HttpMethod_Get, curi, headers, getArguments,
211 NULL /* no body for GET */, 0))
212 { 212 {
213 stream.GetOutput(output); 213 stream.GetOutput(output);
214 return true; 214 return true;
215 } 215 }
216 else 216 else