const char *filename, const char* content_type,
const char *transfer_encoding, const char *data, uint64_t off, size_t size)
{
- if (size == 0) return MHD_NO;
-
+ // logger->info("HTTPDClient: add post field: {} {} {}", key, data, size);
HTTPDClient* httpdclient = (HTTPDClient*)clientIdentifier;
httpdclient->addPostField(key, data, size);
- return MHD_YES;
-
- //Return MHD_YES to continue iterating, MHD_NO to abort the iteration.
+ return MHD_YES; //Return MHD_YES to continue iterating, MHD_NO to abort the iteration.
}
void HTTPDClient::request_completed(void *cls, struct MHD_Connection *mhd_connection,
size_t* upload_data_size, void** userData)
{
/*
- printf("handle_connection called\n");
- printf("hc: cls %p\n", cls);
- printf("hc: mhd_connection %p\n", mhd_connection);
- printf("hc: url %p\n", url);
- if (url) printf("hc: url: %s\n", url);
- printf("hc: method %p\n", method);
- if (url) printf("hc: method: %s\n", method);
- printf("hc: version %p\n", version);
- if (url) printf("hc: version: %s\n", version);
- printf("hc: upload_data %p\n", upload_data);
- printf("hc: upload_data_size %lu\n", *upload_data_size);
- printf("hc: userData %p\n", *userData);
+ logger->debug("handle_connection called");
+ logger->debug("hc: cls {}", (void*)cls);
+ logger->debug("hc: mhd_connection {}", (void*)mhd_connection);
+ logger->debug("hc: url {}", (void*)url);
+ if (url) logger->debug("hc: url: {}", url);
+ logger->debug("hc: method {}", (void*)method);
+ if (url) logger->debug("hc: method: {}", method);
+ logger->debug("hc: version {}", (void*)version);
+ if (url) logger->debug("hc: version: {}", version);
+ logger->debug("hc: upload_data {}", (void*)upload_data);
+ logger->debug("hc: upload_data_size {}", *upload_data_size);
+ logger->debug("hc: userData {}", (void*)*userData);
*/
const MHD_ConnectionInfo* mhdc = MHD_get_connection_info(mhd_connection, MHD_CONNECTION_INFO_SOCKET_CONTEXT);
struct MHD_Response* response = MHD_create_response_from_fd(sbuf.st_size, fd);
int ret = MHD_queue_response(mhd_connection, MHD_HTTP_OK, response);
+
+ getVars.clear();
+ postFields.clear();
MHD_destroy_response(response);
return ret;
struct MHD_Response* response = MHD_create_response_from_buffer(strlen(returnData.c_str()), (void *)returnData.c_str(), MHD_RESPMEM_MUST_COPY);
MHD_add_response_header(response, "Content-Type", "application/json");
int ret = MHD_queue_response(mhd_connection, MHD_HTTP_OK, response);
+
+ getVars.clear();
+ postFields.clear();
MHD_destroy_response(response);
return ret;
}
struct MHD_Response* response = MHD_create_response_from_buffer(strlen(page), (void *)page, MHD_RESPMEM_PERSISTENT);
int ret = MHD_queue_response(mhd_connection, code, response);
+
+ getVars.clear();
+ postFields.clear();
MHD_destroy_response(response);
return ret;
}