Store certs in certs/. Add mg_unpacked()

This commit is contained in:
cpq committed 2023-08-20 23:43:04 +01:00
1 parent 1e0d57a832
commit b32d1c15f0
11 files changed
+2512 -2090

No files matched your search

+9 -5
View File
@@ -855,13 +855,11 @@ struct packed_file {
size_t pos;
};
const char *mg_unpack(const char *path, size_t *size, time_t *mtime);
const char *mg_unlist(size_t no);
#if MG_ENABLE_PACKED_FS
#else
const char *mg_unpack(const char *path, size_t *size, time_t *mtime) {
(void) path, (void) size, (void) mtime;
*size = 0, *mtime = 0;
(void) path;
return NULL;
}
const char *mg_unlist(size_t no) {
@@ -870,6 +868,12 @@ const char *mg_unlist(size_t no) {
}
#endif
struct mg_str mg_unpacked(const char *path) {
size_t len = 0;
const char *buf = mg_unpack(path, &len, NULL);
return mg_str_n(buf, len);
}
static int is_dir_prefix(const char *prefix, size_t n, const char *path) {
// MG_INFO(("[%.*s] [%s] %c", (int) n, prefix, path, path[n]));
return n < strlen(path) && strncmp(prefix, path, n) == 0 &&
@@ -1533,7 +1537,7 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
hm->body.len = 0;
hm->message.len = (size_t) req_len;
}
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
if (hm->message.len < (size_t) req_len) return -1; // Overflow protection
return req_len;
}