Add FS API layer

This commit is contained in:
Sergey Lyubka committed 2021-07-28 21:11:07 +01:00
1 parent b98556a4dc
commit 9346122c29
10 files changed
+660 -309

No files matched your search

+6 -4
View File
@@ -1,6 +1,7 @@
#pragma once
#include "config.h"
#include "fs.h"
#include "net.h"
#include "str.h"
@@ -23,7 +24,8 @@ struct mg_http_serve_opts {
const char *root_dir; // Web root directory, must be non-NULL
const char *ssi_pattern; // SSI file name pattern, e.g. #.shtml
const char *extra_headers; // Extra HTTP headers to add in responses
bool use_packed_fs; // Serve files embedded into binary
const char *mime_types; // Extra mime types, ext1=type1,ext2=type2,..
struct mg_fs *fs; // Filesystem implementation. Use NULL for POSIX
};
// Parameter for mg_http_next_multipart
@@ -43,9 +45,9 @@ struct mg_connection *mg_http_listen(struct mg_mgr *, const char *url,
struct mg_connection *mg_http_connect(struct mg_mgr *, const char *url,
mg_event_handler_t fn, void *fn_data);
void mg_http_serve_dir(struct mg_connection *, struct mg_http_message *hm,
struct mg_http_serve_opts *);
void mg_http_serve_file(struct mg_connection *, struct mg_http_message *,
const char *, const char *mime, const char *headers);
struct mg_http_serve_opts *opts);
void mg_http_serve_file(struct mg_connection *, struct mg_http_message *hm,
const char *path, struct mg_http_serve_opts *opts);
void mg_http_reply(struct mg_connection *, int status_code, const char *headers,
const char *body_fmt, ...);
struct mg_str *mg_http_get_header(struct mg_http_message *, const char *name);