1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Call follow-url hook on redirects

In redirect_cache, call the follow-url hook so that scripts can modify
URIs in redirects.
This commit is contained in:
Miciah Dashiel Butler Masters 2011-10-27 19:59:17 +00:00
parent 56f1b5d834
commit 4eb7827fe5

19
src/cache/cache.c vendored
View File

@ -723,6 +723,25 @@ redirect_cache(struct cache_entry *cached, unsigned char *location,
if (!uristring) return NULL;
#ifdef CONFIG_SCRIPTING
{
static int follow_url_event_id = EVENT_NONE;
set_event_id(follow_url_event_id, "follow-url");
trigger_event(follow_url_event_id, &uristring, NULL);
if (!uristring || !*uristring) {
mem_free_if(uristring);
return NULL;
}
/* FIXME: Compare if uristring and struri(uri) are equal */
/* FIXME: When uri->post will no longer be an encoded string (but
* hopefully some refcounted object) we will have to assign the post
* data object to the translated URI. */
}
#endif
/* Only add the post data if the redirect should not use GET method.
* This is tied to the HTTP handling of the 303 and (if the
* protocol.http.bugs.broken_302_redirect is enabled) the 302 status