diff options
author | Vincent Douillet <vincent@vdouillet.fr> | 2024-09-11 11:20:31 +0200 |
---|---|---|
committer | Vincent Douillet <vincent@vdouillet.fr> | 2024-09-11 11:20:31 +0200 |
commit | 19e47daa9c1fb55f2cb9e639d5a6ef16b5bc4e88 (patch) | |
tree | 2b98ac0700a11cb142625d8355019c44b49c1850 /http.c | |
parent | 4e921ffa31fdca2425d326efda1c6d9ad190359a (diff) |
url: fix encoding for use in http context
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -34,7 +34,7 @@ #include "http.h" #include "mime.h" -#include "str.h" +#include "url.h" bool http_open_file(struct kreq * r, enum khttp code, const struct file * f) @@ -49,13 +49,9 @@ http_open_file(struct kreq * r, enum khttp code, const struct file * f) return false; /* file name needs to be url encoded for special chars */ - filename = khttp_urlencode(filename); - if (filename == NULL) + if ((filename = url_encode(filename)) == NULL) return false; - /* but for some reason, spaces should remain spaces... */ - str_replace(filename, '+', ' '); - khttp_head(r, kresps[KRESP_STATUS], "%s", khttps[code]); khttp_head(r, kresps[KRESP_CONTENT_DISPOSITION], "attachment;filename=\"%s\"", filename); |