1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

[uri] Do not return earlier. Check also POST

This commit is contained in:
Witold Filipczyk 2022-09-27 19:54:24 +02:00
parent 03d7311cec
commit 8c2f1092f6
2 changed files with 27 additions and 15 deletions

View File

@ -685,6 +685,17 @@ xhr_send(JSContext *ctx, unsigned int argc, JS::Value *rval)
if (xhr->method == POST && argc == 1) {
body = jsval_to_string(ctx, args[0]);
xhr->uri->post = body;
char *url2 = get_uri_string(xhr->uri, URI_DIR_LOCATION | URI_PATH | URI_USER | URI_PASSWORD | URI_POST);
if (!url2) {
mem_free(body);
return false;
}
done_uri(xhr->uri);
xhr->uri = get_uri(url2, URI_DIR_LOCATION | URI_PATH | URI_USER | URI_PASSWORD | URI_POST);
mem_free(url2);
mem_free(body);
}
xhr->download.data = xhr;
xhr->download.callback = (download_callback_T *)xhr_loading_callback;

View File

@ -618,25 +618,26 @@ add_uri_to_string(struct string *string, const struct uri *uri,
add_char_to_string(string, '/');
}
if (!uri->datalen) return string;
if (uri->datalen) {
if (uri->protocol == PROTOCOL_DATA) {
char *e;
add_to_string(string, "data");
e = get_extension_from_uri((struct uri *) uri);
if (uri->protocol == PROTOCOL_DATA) {
char *e;
add_to_string(string, "data");
e = get_extension_from_uri((struct uri *) uri);
if (e) {
add_to_string(string, e);
mem_free(e);
if (e) {
add_to_string(string, e);
mem_free(e);
}
return string;
}
return string;
for (pos = filename; *pos && !end_of_dir(*pos); pos++)
if (wants(URI_FILENAME) && is_uri_dir_sep(uri, *pos))
filename = pos + 1;
add_bytes_to_string(string, filename, pos - filename);
}
for (pos = filename; *pos && !end_of_dir(*pos); pos++)
if (wants(URI_FILENAME) && is_uri_dir_sep(uri, *pos))
filename = pos + 1;
return add_bytes_to_string(string, filename, pos - filename);
}
if (wants(URI_QUERY) && uri->datalen) {