Small improvements
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "../workers.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
static int local_handler(client_ctx_t *ctx);
|
||||
|
||||
@ -112,6 +113,7 @@ static int local_handler(client_ctx_t *ctx) {
|
||||
ctx->file = fopen(uri->meta->filename_comp_br, "rb");
|
||||
if (ctx->file == NULL) {
|
||||
cache_mark_dirty(ctx->conf->cache, uri->filename);
|
||||
errno = 0;
|
||||
} else {
|
||||
http_add_header_field(&res->hdr, "Content-Encoding", "br");
|
||||
enc = COMPRESS_BR;
|
||||
@ -120,6 +122,7 @@ static int local_handler(client_ctx_t *ctx) {
|
||||
ctx->file = fopen(uri->meta->filename_comp_gz, "rb");
|
||||
if (ctx->file == NULL) {
|
||||
cache_mark_dirty(ctx->conf->cache, uri->filename);
|
||||
errno = 0;
|
||||
} else {
|
||||
http_add_header_field(&res->hdr, "Content-Encoding", "gzip");
|
||||
enc = COMPRESS_GZ;
|
||||
|
@ -375,6 +375,7 @@ void request_complete(client_ctx_t *ctx) {
|
||||
ctx->req_e = clock_micros();
|
||||
info("Transfer complete: %s", format_duration(ctx->req_e - ctx->req_s, buf));
|
||||
|
||||
if (ctx->file) fclose(ctx->file);
|
||||
free(ctx->msg_buf_ptr);
|
||||
uri_free(&ctx->uri);
|
||||
http_free_req(&ctx->req);
|
||||
|
Reference in New Issue
Block a user