X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=libs%2Fshttpd%2Fio_file.c;h=1dce074fb49bc04f62d579f56c294c959dbee9d0;hp=d2b3fb66aac1a9c8778378c495aff85c00250a73;hb=1dee4e3cd008a27789bbce05b0eb47b0eb5d121a;hpb=3dc3ac3cfe10b7196a7977e9c041c29fa141c35e diff --git a/libs/shttpd/io_file.c b/libs/shttpd/io_file.c index d2b3fb6..1dce074 100644 --- a/libs/shttpd/io_file.c +++ b/libs/shttpd/io_file.c @@ -98,8 +98,8 @@ get_file(struct conn *c, struct stat *stp) const char *fmt = "%a, %d %b %Y %H:%M:%S GMT", *msg = "OK"; big_int_t cl; /* Content-Length */ - if (c->mime_type == NULL) - c->mime_type = get_mime_type(c->ctx, c->uri, strlen(c->uri)); + if (c->mime_type.len == 0) + get_mime_type(c->ctx, c->uri, strlen(c->uri), &c->mime_type); cl = (big_int_t) stp->st_size; /* If Range: header specified, act accordingly */ @@ -131,11 +131,12 @@ get_file(struct conn *c, struct stat *stp) "Date: %s\r\n" "Last-Modified: %s\r\n" "Etag: \"%s\"\r\n" - "Content-Type: %s\r\n" + "Content-Type: %.*s\r\n" "Content-Length: %lu\r\n" - "Connection: close\r\n" + "Accept-Ranges: bytes\r\n" "%s\r\n", - status, msg, date, lm, etag, c->mime_type, cl, range); + status, msg, date, lm, etag, + c->mime_type.len, c->mime_type.ptr, cl, range); c->status = status; c->loc.content_len = cl;