mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Add MG_ARCH_TREADX
This commit is contained in:
1 parent
bfca233160
commit
3a0fe5288c
12 files changed
+133
-92
No files matched your search
+3
-5
@@ -589,13 +589,11 @@ void mg_http_serve_file(struct mg_connection *c, struct mg_http_message *hm,
|
||||
// If a browser sends us "Accept-Encoding: gzip", try to open .gz first
|
||||
struct mg_str *ae = mg_http_get_header(hm, "Accept-Encoding");
|
||||
if (ae != NULL) {
|
||||
char *ae_ = mg_mprintf("%.*s", ae->len, ae->buf);
|
||||
if (ae_ != NULL && strstr(ae_, "gzip") != NULL) {
|
||||
if (mg_match(*ae, mg_str("*gzip*"), NULL)) {
|
||||
mg_snprintf(tmp, sizeof(tmp), "%s.gz", path);
|
||||
fd = mg_fs_open(fs, tmp, MG_FS_READ);
|
||||
if (fd != NULL) gzip = true, path = tmp;
|
||||
}
|
||||
free(ae_);
|
||||
}
|
||||
// No luck opening .gz? Open what we've told to open
|
||||
if (fd == NULL) fd = mg_fs_open(fs, path, MG_FS_READ);
|
||||
@@ -686,7 +684,7 @@ static void printdirentry(const char *name, void *userdata) {
|
||||
sizeof(path)) {
|
||||
MG_ERROR(("%s truncated", name));
|
||||
} else if ((flags = fs->st(path, &size, &t)) == 0) {
|
||||
MG_ERROR(("%lu stat(%s): %d", d->c->id, path, errno));
|
||||
MG_ERROR(("%lu stat(%s)", d->c->id, path));
|
||||
} else {
|
||||
const char *slash = flags & MG_FS_DIR ? "/" : "";
|
||||
if (flags & MG_FS_DIR) {
|
||||
@@ -977,7 +975,7 @@ long mg_http_upload(struct mg_connection *c, struct mg_http_message *hm,
|
||||
mg_http_reply(c, 400, "", "%s: offset mismatch", path);
|
||||
res = -5;
|
||||
} else if ((fd = mg_fs_open(fs, path, MG_FS_WRITE)) == NULL) {
|
||||
mg_http_reply(c, 400, "", "open(%s): %d", path, errno);
|
||||
mg_http_reply(c, 400, "", "open(%s)", path);
|
||||
res = -6;
|
||||
} else {
|
||||
res = offset + (long) fs->wr(fd->fd, hm->body.buf, hm->body.len);
|
||||
|
||||
Reference in new issue
Block a user