diff options
| author | 2024-09-15 15:03:21 +0200 | |
|---|---|---|
| committer | 2024-09-15 18:39:49 +0200 | |
| commit | ba5cbb6d828165a43826c6afdd71fa2edbdca302 (patch) | |
| tree | 87290e2f2a97433c35f0ce86cd14cabe9703dd2c /xs_fcgi.h | |
| parent | Minor code cleaning. (diff) | |
| download | snac2-ba5cbb6d828165a43826c6afdd71fa2edbdca302.tar.gz snac2-ba5cbb6d828165a43826c6afdd71fa2edbdca302.tar.xz snac2-ba5cbb6d828165a43826c6afdd71fa2edbdca302.zip | |
URL decode data after splitting the arguments
Data decoding should happen after the parsing if not, a '?', '&', '#'
or other character decoded will interfere with the parsing. e.g. the
users password contains a '&', then it is truncated on that character,
and login will fail.
Diffstat (limited to '')
| -rw-r--r-- | xs_fcgi.h | 6 |
1 files changed, 2 insertions, 4 deletions
| @@ -179,8 +179,7 @@ xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *fcgi_id) | |||
| 179 | req = xs_dict_append(req, "method", v); | 179 | req = xs_dict_append(req, "method", v); |
| 180 | else | 180 | else |
| 181 | if (strcmp(k, "REQUEST_URI") == 0) { | 181 | if (strcmp(k, "REQUEST_URI") == 0) { |
| 182 | xs *udp = xs_url_dec(v); | 182 | xs *pnv = xs_split_n(v, "?", 1); |
| 183 | xs *pnv = xs_split_n(udp, "?", 1); | ||
| 184 | 183 | ||
| 185 | /* store the path */ | 184 | /* store the path */ |
| 186 | req = xs_dict_append(req, "path", xs_list_get(pnv, 0)); | 185 | req = xs_dict_append(req, "path", xs_list_get(pnv, 0)); |
| @@ -233,8 +232,7 @@ xs_dict *xs_fcgi_request(FILE *f, xs_str **payload, int *p_size, int *fcgi_id) | |||
| 233 | const char *ct = xs_dict_get(req, "content-type"); | 232 | const char *ct = xs_dict_get(req, "content-type"); |
| 234 | 233 | ||
| 235 | if (*payload && ct && strcmp(ct, "application/x-www-form-urlencoded") == 0) { | 234 | if (*payload && ct && strcmp(ct, "application/x-www-form-urlencoded") == 0) { |
| 236 | xs *upl = xs_url_dec(*payload); | 235 | p_vars = xs_url_vars(*payload); |
| 237 | p_vars = xs_url_vars(upl); | ||
| 238 | } | 236 | } |
| 239 | else | 237 | else |
| 240 | if (*payload && ct && xs_startswith(ct, "multipart/form-data")) { | 238 | if (*payload && ct && xs_startswith(ct, "multipart/form-data")) { |