mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 12:12:35 +03:00
Eat any #fragment in llcache_object_retrieve -- fixing double-fragment issues at the top level, and preventing fragment(ed) redirects from confusing the issue
svn path=/trunk/netsurf/; revision=10399
This commit is contained in:
parent
b56886d0ee
commit
2ba2dab3a7
@ -533,6 +533,7 @@ nserror llcache_object_retrieve(const char *url, uint32_t flags,
|
|||||||
bool has_query;
|
bool has_query;
|
||||||
url_func_result res;
|
url_func_result res;
|
||||||
struct url_components components;
|
struct url_components components;
|
||||||
|
char *defragmented_url;
|
||||||
|
|
||||||
#ifdef LLCACHE_TRACE
|
#ifdef LLCACHE_TRACE
|
||||||
LOG(("Retrieve %s (%x, %s, %p)", url, flags, referer, post));
|
LOG(("Retrieve %s (%x, %s, %p)", url, flags, referer, post));
|
||||||
@ -551,30 +552,42 @@ nserror llcache_object_retrieve(const char *url, uint32_t flags,
|
|||||||
return NSERROR_NOMEM;
|
return NSERROR_NOMEM;
|
||||||
|
|
||||||
has_query = (components.query != NULL);
|
has_query = (components.query != NULL);
|
||||||
|
|
||||||
|
components.fragment = NULL;
|
||||||
|
|
||||||
|
defragmented_url = url_reform_components(&components);
|
||||||
|
|
||||||
url_destroy_components(&components);
|
url_destroy_components(&components);
|
||||||
|
|
||||||
|
if (defragmented_url == NULL)
|
||||||
|
return NSERROR_NOMEM;
|
||||||
|
|
||||||
if (flags & LLCACHE_RETRIEVE_FORCE_FETCH || post != NULL) {
|
if (flags & LLCACHE_RETRIEVE_FORCE_FETCH || post != NULL) {
|
||||||
/* Create new object */
|
/* Create new object */
|
||||||
error = llcache_object_new(url, &obj);
|
error = llcache_object_new(defragmented_url, &obj);
|
||||||
if (error != NSERROR_OK)
|
if (error != NSERROR_OK) {
|
||||||
|
free(defragmented_url);
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Attempt to kick-off fetch */
|
/* Attempt to kick-off fetch */
|
||||||
error = llcache_object_fetch(obj, flags, referer, post,
|
error = llcache_object_fetch(obj, flags, referer, post,
|
||||||
redirect_count);
|
redirect_count);
|
||||||
if (error != NSERROR_OK) {
|
if (error != NSERROR_OK) {
|
||||||
llcache_object_destroy(obj);
|
llcache_object_destroy(obj);
|
||||||
|
free(defragmented_url);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add new object to uncached list */
|
/* Add new object to uncached list */
|
||||||
llcache_object_add_to_list(obj, &llcache_uncached_objects);
|
llcache_object_add_to_list(obj, &llcache_uncached_objects);
|
||||||
} else {
|
} else {
|
||||||
error = llcache_object_retrieve_from_cache(url, flags, referer,
|
error = llcache_object_retrieve_from_cache(defragmented_url, flags, referer,
|
||||||
post, redirect_count, &obj);
|
post, redirect_count, &obj);
|
||||||
if (error != NSERROR_OK)
|
if (error != NSERROR_OK) {
|
||||||
|
free(defragmented_url);
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returned object is already in the cached list */
|
/* Returned object is already in the cached list */
|
||||||
}
|
}
|
||||||
@ -586,7 +599,9 @@ nserror llcache_object_retrieve(const char *url, uint32_t flags,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
*result = obj;
|
*result = obj;
|
||||||
|
|
||||||
|
free(defragmented_url);
|
||||||
|
|
||||||
return NSERROR_OK;
|
return NSERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user