summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'http.c')
-rw-r--r--http.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/http.c b/http.c
index ef8d90c..5bad1d8 100644
--- a/http.c
+++ b/http.c
@@ -37,12 +37,19 @@
#include "str.h"
bool
-http_open_file(struct kreq * r, enum khttp code, struct file * f)
+http_open_file(struct kreq * r, enum khttp code, const struct file * f)
{
char *filename;
+ if (f == NULL || f->path == NULL)
+ return false;
+
+ filename = file_get_basename(f);
+ if (filename == NULL)
+ return false;
+
/* file name needs to be url encoded for special chars */
- filename = khttp_urlencode(f->name);
+ filename = khttp_urlencode(filename);
if (filename == NULL)
return false;
@@ -69,7 +76,7 @@ http_open(struct kreq * r, enum khttp code, enum kmime mime)
}
void
-http_exit(struct kreq * r, enum khttp code, char *content,...)
+http_exit(const struct kreq * r, enum khttp code, const char *content,...)
{
va_list args;