I am using Mongoose from within my application. I am composing my HTTP reply
messages for most requests, but I also have to do file transfer. I would like
to use the function handle_file_request to send a file to the client (to avoid
code duplication), but this function is static. Would it be possible to add a
public mg_send_file function, that sends a file to the client?
I tried the following code, which does the job:
void mg_send_file(struct mg_connection *conn, const char *path)
{
struct mgstat st;
if (mg_stat(path, &st) != 0)
{
send_http_error(conn, 404, "Not Found", "%s", "File not found");
}
handle_file_request(conn, path, &st);
}
Could this be added to Mongoose?
Original issue reported on code.google.com by borkh...@gmail.com on 1 Jun 2011 at 7:43
Original issue reported on code.google.com by
borkh...@gmail.com
on 1 Jun 2011 at 7:43