I'm developing a simple moongose based web server to send a file passed as argument over HTTP whatever the request is, but on each request I'm getting a stack overflow error.
Here is my code:
#include <stdio.h>
#include <string.h>
#include "mongoose.h"
// file path
char *path;
static void *callback(enum mg_event event, struct mg_connection *conn)
{
const struct mg_request_info *request_info = mg_get_request_info(conn);
mg_send_file(conn, path);
return "";
}
int main(int argc,char *argv[])
{
struct mg_context *ctx;
const char *options[] = {"listening_ports", "8081", NULL};
// registers file
path = argv[1];
ctx = mg_start(&callback, NULL, options);
printf("%s", path);
getchar(); // Wait until user hits "enter"
mg_stop(ctx);
return 0;
}
I'm using visual studio 2010 to build the project
Does anyone have any idea on what may cause this error?