comparison Core/HttpServer/MongooseServer.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 895ab369d63c
children f967bdf8534e
comparison
equal deleted inserted replaced
1445:d26c8a93d05a 1446:8dc80ba768aa
620 } 620 }
621 } 621 }
622 622
623 623
624 // Extract the body of the request for PUT and POST 624 // Extract the body of the request for PUT and POST
625
626 // TODO Avoid unneccessary memcopy of the body
627
625 std::string body; 628 std::string body;
626 if (method == HttpMethod_Post || 629 if (method == HttpMethod_Post ||
627 method == HttpMethod_Put) 630 method == HttpMethod_Put)
628 { 631 {
629 PostDataStatus status; 632 PostDataStatus status;
687 690
688 try 691 try
689 { 692 {
690 if (that->HasHandler()) 693 if (that->HasHandler())
691 { 694 {
692 found = that->GetHandler().Handle(output, method, uri, headers, argumentsGET, body); 695 found = that->GetHandler().Handle(output, method, uri, headers, argumentsGET, body.c_str(), body.size());
693 } 696 }
694 } 697 }
695 catch (OrthancException& e) 698 catch (OrthancException& e)
696 { 699 {
697 // Using this candidate handler results in an exception 700 // Using this candidate handler results in an exception