aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index cdb1aed..b9f0b50 100644
--- a/main.c
+++ b/main.c
@@ -1356,6 +1356,7 @@ static int createdir(const struct http_payload *const p,
struct dynstr d, userd;
struct form *forms = NULL;
size_t n = 0;
+ char *encurl = NULL;
dynstr_init(&d);
dynstr_init(&userd);
@@ -1469,7 +1470,12 @@ static int createdir(const struct http_payload *const p,
.status = HTTP_STATUS_SEE_OTHER
};
- if (http_response_add_header(r, "Location", userd.str))
+ if (!(encurl = http_encode_url(userd.str)))
+ {
+ fprintf(stderr, "%s: http_encode_url failed\n", __func__);
+ goto end;
+ }
+ else if (http_response_add_header(r, "Location", encurl))
{
fprintf(stderr, "%s: http_response_add_header failed\n", __func__);
goto end;
@@ -1482,6 +1488,7 @@ end:
forms_free(forms, n);
dynstr_free(&userd);
dynstr_free(&d);
+ free(encurl);
return ret;
}