mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[xhr] Try to generate right uri for ajax call.
This commit is contained in:
parent
8ea4b24092
commit
8297cf0df9
@ -368,7 +368,30 @@ xhr_send(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
|||||||
}
|
}
|
||||||
xhr->download.data = xhr;
|
xhr->download.data = xhr;
|
||||||
xhr->download.callback = (download_callback_T *)xhr_loading_callback;
|
xhr->download.callback = (download_callback_T *)xhr_loading_callback;
|
||||||
struct uri *uri = get_uri(xhr->responseURL, URI_NONE);
|
|
||||||
|
struct uri *uri = NULL;
|
||||||
|
|
||||||
|
if (!strchr(xhr->responseURL, '/')) {
|
||||||
|
char *ref = get_uri_string(vs->uri, URI_DIR_LOCATION | URI_PATH);
|
||||||
|
|
||||||
|
if (ref) {
|
||||||
|
char *slash = strrchr(ref, '/');
|
||||||
|
|
||||||
|
if (slash) {
|
||||||
|
*slash = '\0';
|
||||||
|
}
|
||||||
|
char *url = straconcat(ref, "/", xhr->responseURL, NULL);
|
||||||
|
|
||||||
|
if (url) {
|
||||||
|
uri = get_uri(url, URI_NONE);
|
||||||
|
mem_free(url);
|
||||||
|
}
|
||||||
|
mem_free(ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!uri) {
|
||||||
|
uri = get_uri(xhr->responseURL, URI_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
if (uri) {
|
if (uri) {
|
||||||
load_uri(uri, doc_view->session->referrer, &xhr->download, PRI_MAIN, CACHE_MODE_NORMAL, -1);
|
load_uri(uri, doc_view->session->referrer, &xhr->download, PRI_MAIN, CACHE_MODE_NORMAL, -1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user