I've written a HTTP client in Poco which sends POST request to the HTTPServer Following is the snippet
Poco::Net::HTTPClientSession s("127.0.0.1", 9090);
Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, "/echo");
std::string body("rs=this is a random request body");
request.setContentLength(body.length());
s.sendRequest(request) << body;
The server receives the request, but following is the only way I could find to get the steam ( ie rs=this is a ....)
void SRequestHandler::handleRequest(Poco::Net::HTTPServerRequest& hreq, Poco::Net::HTTPServerResponse& resp){
std::istream &i = hreq.stream();
Poco::StreamCopier::copyStream(i, ss, hreq.getContentLength());
}
So the way left to get content sent by client is using the string. Is there a simpler/direct way of getting the content ?