Serve current dir by default in mg_serve_http()

PUBLISHED_FROM=421b4256629b2bccd20ceb127ece02be57085b40
This commit is contained in:
Sergey Lyubka 2015-10-21 12:15:00 +03:00 committed by Marko Mikulicic
parent 96409e74e5
commit dcd4e660a3

View File

@ -5772,7 +5772,10 @@ void mg_serve_http(struct mg_connection *nc, struct http_message *hm,
struct mg_serve_http_opts opts) {
char path[MG_MAX_PATH];
struct mg_str *hdr;
uri_to_path(hm, path, sizeof(path), &opts);
if (opts.document_root == NULL) {
opts.document_root = ".";
}
if (opts.per_directory_auth_file == NULL) {
opts.per_directory_auth_file = ".htpasswd";
}
@ -5788,6 +5791,8 @@ void mg_serve_http(struct mg_connection *nc, struct http_message *hm,
if (opts.index_files == NULL) {
opts.index_files = "index.html,index.htm,index.shtml,index.cgi,index.php";
}
uri_to_path(hm, path, sizeof(path), &opts);
mg_send_http_file(nc, path, sizeof(path), hm, &opts);
/* Close connection for non-keep-alive requests */