feat: add mime types
This commit is contained in:
parent
0d5c6d0f39
commit
89fb77db7f
7 changed files with 86 additions and 14 deletions
|
|
@ -40,7 +40,8 @@ void http_loop_ctx_reset(http_loop_ctx *ctx) {
|
|||
ctx->res.head = NULL;
|
||||
}
|
||||
|
||||
if (ctx->res.body_type == http_body_buf && ctx->res.body.buf != NULL) {
|
||||
if (ctx->res.body_type == http_body_buf && ctx->res.body.buf != NULL &&
|
||||
ctx->res.owns_body) {
|
||||
free(ctx->res.body.buf);
|
||||
ctx->res.body.buf = NULL;
|
||||
} else if (ctx->res.body_type == http_body_file &&
|
||||
|
|
|
|||
|
|
@ -30,3 +30,8 @@ void http_loop_res_add_header(http_loop_ctx *ctx, http_header type,
|
|||
|
||||
ctx->res.header_count++;
|
||||
}
|
||||
|
||||
void http_loop_res_set_mime_type(http_loop_ctx *ctx, http_mime_type mime_type) {
|
||||
http_loop_res_add_header(ctx, http_header_content_type,
|
||||
http_mime_type_names[mime_type][1], false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue