commit 39f34a3878a505ac79f82e2c5e3acc0ea7b871e7
parent fdb1f6399188aeec96924ff406d53aa2fb5c625d
Author: Kyle Milz <kmilz@ucalgary.ca>
Date: Wed, 17 Oct 2012 22:12:57 -0600
main: detect between client and server redirects
Diffstat:
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -183,10 +183,15 @@ hist_nav_cb(const Evas_Object *view, Ewk_Navigation_Data *nav_data, void *data)
}
static void
-hist_redir_cb(const Evas_Object *vew, const char *source_url, const char *dest_url, void *data)
+hist_redir_cb(const Evas_Object *view, const char *source_url, const char *dest_url, void *data)
{
int prefix, min, suffix, src_len, dest_len;
+ if (strcmp(ewk_view_url_get(view), dest_url) != 0) {
+ printf("hist_redir_cb() not showing third party redirect\n");
+ return;
+ }
+
src_len = strlen(source_url);
dest_len = strlen(dest_url);
@@ -220,7 +225,22 @@ hist_redir_cb(const Evas_Object *vew, const char *source_url, const char *dest_u
eina_strbuf_append_n(buf, source_url + src_len - suffix, suffix);
printf("redirection() %s\n", eina_strbuf_string_steal(buf));
+}
+
+static void
+hist_client_redir_cb(const Evas_Object *view, const char *source_url, const char *dest_url, void *data)
+{
+ printf("client cur url = %s\n", ewk_view_url_get(view));
+ printf("client ");
+ hist_redir_cb(view, source_url, dest_url, data);
+}
+static void
+hist_server_redir_cb(const Evas_Object *view, const char *source_url, const char *dest_url, void *data)
+{
+ printf("server cur url = %s\n", ewk_view_url_get(view));
+ printf("server ");
+ hist_redir_cb(view, source_url, dest_url, data);
}
static void
@@ -275,8 +295,8 @@ setup_main_callbacks(App_Data *ad, const char *cookie_path)
ewk_context_history_callbacks_set(
context,
hist_nav_cb,
- hist_redir_cb,
- hist_redir_cb,
+ hist_client_redir_cb,
+ hist_server_redir_cb,
hist_title_updated_cb,
hist_visited_cb,
ad