I'm attempting to submit a POST request to an http server, and I seem to be missing something fundamental.
In main, I have this snippet:
...
string req = generate_request();
string postdata = generate_postdata(req);
URI uri("http://foo.bar.com/1.1");
std::string path(uri.getPathAndQuery());
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest request(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1);
HTTPResponse response;
do_stuff(session, request, response, postdata);
...
generate_request does nothing more than build a urlencoded xml string that looks like this:
%3Creq%3E%3Cemail%3E%3Crecipient%3E127c08d531eb161d2c02d4404706b623%3C%2Frecipient%3E%3Clist%3E4133%3C%2Flist%3E%3C%2Femail%3E%3C%2Freq%3E
generate_postdata does this:
url = "domain1=" + redir + "&domain2=" + redir;
url += "&logtoken=" + token + "&request=" + request_str + "&test=1";
do_stuff does this:
request.setContentType("application/x-www-form-urlencoded");
session.sendRequest(request) << req;
where the variable req is the output of the generate_postdata() function.
The server doesn't appear to be receiving the post data, and I can't figure out why not.





