Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use microhttpd MHD_Result return type. fix: error: invalid conversion from int to MHD_Result #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/http_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ string fetchRemoteFile(string scriptUrl, string dir, bool preferID = true) {
}


int sendFile(struct MHD_Connection *connection, const char *file) {
MHD_Result sendFile(struct MHD_Connection *connection, const char *file) {

int ret;
MHD_Result ret;
struct MHD_Response *response;

log(stdout, "Request to send back file '%s'", file);
Expand Down Expand Up @@ -282,9 +282,9 @@ int sendFile(struct MHD_Connection *connection, const char *file) {
#if 0
// old version: serves the file in source format
// serve a script with the given id
int fetchTest(struct MHD_Connection *connection, const char *id) {
MHD_Result fetchTest(struct MHD_Connection *connection, const char *id) {

int ret;
MHD_Result ret;
struct MHD_Response *response;

// Now, we have to sanitize id, check that id has only hex-decimal characters
Expand Down Expand Up @@ -363,9 +363,9 @@ int fetchTest(struct MHD_Connection *connection, const char *id) {

// serve a script with the given id
// new version: serves the compact representation of the parsed script
int fetchTest(struct MHD_Connection *connection, const char *id, bool recursiveSearch = false, bool doSerialize = true) {
MHD_Result fetchTest(struct MHD_Connection *connection, const char *id, bool recursiveSearch = false, bool doSerialize = true) {

int ret;
MHD_Result ret;
struct MHD_Response *response;

// Now, we have to sanitize id, check that id has only hex-decimal characters
Expand Down Expand Up @@ -537,15 +537,15 @@ bool getline(char *buf, int bufsize, FILE *infile) {
}


int proxyTestResultPage(struct MHD_Connection *connection, const char *id, const char *ip, const char *hostname, const char *nextPage) {
MHD_Result proxyTestResultPage(struct MHD_Connection *connection, const char *id, const char *ip, const char *hostname, const char *nextPage) {

// - Use ID, IP, and Hostname to find the log file of the test run
// - Parse the log file and read in the parameters
// - Create a web page with a HTTP POST form and a hidden form with all the parameters.
// Add JScript that immediately submits the form to the server
// Add a button, say that the results are ready and that the user should click the button

int ret;
MHD_Result ret;
struct MHD_Response *response;
string fname = logDir + "/glasnost_" + ip + '_' + hostname + '_' + id + ".log";

Expand Down Expand Up @@ -643,7 +643,7 @@ int proxyTestResultPage(struct MHD_Connection *connection, const char *id, const
return ret;
}

static int answerToConnection(void * cls, struct MHD_Connection * connection,
static MHD_Result answerToConnection(void * cls, struct MHD_Connection * connection,
const char * url, const char * method, const char * version,
const char * upload_data, size_t * upload_data_size, void ** ptr) {

Expand Down Expand Up @@ -709,7 +709,7 @@ static int answerToConnection(void * cls, struct MHD_Connection * connection,

error(stderr, "Unknown request: %s", url);
struct MHD_Response *response = MHD_create_response_from_data(strlen(errorPage400), (void*) errorPage400, MHD_NO, MHD_NO);
int ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_BAD_REQUEST, response);
MHD_destroy_response(response);
return ret;
}
Expand Down