src/HTTPServer.cpp
branchv_0
changeset 5 121981e6bd54
parent 4 37a86904145c
child 8 90990c8b6aef
equal deleted inserted replaced
4:37a86904145c 5:121981e6bd54
    54 		// TODO: return also HTTP headers
    54 		// TODO: return also HTTP headers
    55 		if (impl->requestHandler) {
    55 		if (impl->requestHandler) {
    56 			HTTPServer::Request request;
    56 			HTTPServer::Request request;
    57 			request.method = method;
    57 			request.method = method;
    58 			request.url = url;
    58 			request.url = url;
       
    59 
       
    60 			// TODO: return also client IP address etc.
       
    61 			// const MHD_ConnectionInfo* connetionInfo = MHD_get_connection_info(connection, MHD_ConnectionInfoType::MHD_CONNECTION_INFO_CLIENT_ADDRESS);
       
    62 
    59 			// FIXME: request.body = ...
    63 			// FIXME: request.body = ...
    60 			// FIXME: multiple calls for one request
    64 			// FIXME: multiple calls for one request
    61 			const HTTPServer::Response response = impl->requestHandler->handle(request);
    65 			const HTTPServer::Response response = impl->requestHandler->handle(request);
    62 			struct MHD_Response* mhdResponse = MHD_create_response_from_buffer(response.body.size(), (void*) response.body.c_str(), MHD_RESPMEM_MUST_COPY);
    66 			struct MHD_Response* mhdResponse = MHD_create_response_from_buffer(response.body.size(), (void*) response.body.c_str(), MHD_RESPMEM_MUST_COPY);
    63 			for (Header h : response.header) MHD_add_response_header(mhdResponse, h.name.c_str(), h.value.c_str());
    67 			for (Header h : response.header) MHD_add_response_header(mhdResponse, h.name.c_str(), h.value.c_str());