From b4c43b9bde970d5bcff4f296919648cbc5915e58 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 5 Dec 2006 14:45:48 +0000 Subject: [PATCH] Make sure get_last_url() behaves like advertised and fast-redirects{} can be combined with redirect{}. --- filters.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/filters.c b/filters.c index be0f39c1..37340558 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.66 2006/09/23 13:26:38 roro Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.67 2006/11/28 15:19:43 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -40,6 +40,11 @@ const char filters_rcs[] = "$Id: filters.c,v 1.66 2006/09/23 13:26:38 roro Exp $ * * Revisions : * $Log: filters.c,v $ + * Revision 1.67 2006/11/28 15:19:43 fabiankeil + * Implemented +redirect{s@foo@bar@} to generate + * a redirect based on a rewritten version of the + * original URL. + * * Revision 1.66 2006/09/23 13:26:38 roro * Replace TABs by spaces in source code. * @@ -1276,8 +1281,16 @@ char *get_last_url(char *subject, const char *redirect_mode) new_url = tmp++; } - if (new_url != subject) + if (new_url != subject || (0 == strncmpic(subject, "http://", 7))) { + /* + * Return new URL if we found a redirect + * or if the subject already was a URL. + * + * The second case makes sure that we can + * chain get_last_url after another redirection check + * (like rewrite_url) without losing earlier redirects. + */ new_url = strdup(new_url); freez(subject); return new_url; -- 2.39.2