[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] libmicrohttpd with c++ issue
From: |
Carlos Palhares |
Subject: |
[libmicrohttpd] libmicrohttpd with c++ issue |
Date: |
Tue, 29 Jun 2010 17:46:22 -0300 |
Hello guys, how are you?
I believe you're very busy people, but, I wouldn't bother you if I had
any other option. First of all, here is a code snippet which I'll
approach:
int Milx::Server::Daemon::_queue_response(struct MHD_Connection *conn,
Milx::WebCall &call)
{
struct MHD_Response *response;
std::string content = call.content().str();
response = MHD_create_response_from_data(content.size(),
(void*)content.c_str(), MHD_NO, MHD_NO);
MHD_add_response_header(response, MHD_HTTP_HEADER_CONTENT_TYPE,
call.content_type().c_str());
MHD_add_response_header(response, MHD_HTTP_HEADER_SERVER,
MILX_SERVER_NAME);
int ret = MHD_queue_response(conn, call.status(), response);
MHD_destroy_response(response);
return ret;
}
If I debug on the marked lines, I can clearly see that the field data in
MHD_Response is being correctly filled, but when it's sent back to the
HTTP client, the first bytes of the content are totally fuzzy! They're
changed. Another weird thing is that if I do something like this:
const char * tmp = "testing string";
response = MHD_create_response_from_data(strlen(tmp),
tmp, MHD_NO, MHD_NO);
it simple works perfectly!!!
So guys, do you guys have any clue?
- [libmicrohttpd] libmicrohttpd with c++ issue,
Carlos Palhares <=