[interchange-cvs] interchange - jon modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed Jun 27 18:42:37 EDT 2007
User: jon
Date: 2007-06-27 22:42:36 GMT
Modified: lib/Vend Config.pm Dispatch.pm
Log:
Add new BounceReferrals catalog directive, a boolean option.
When disabled (the default), there is no behavioral change.
When enabled, GET requests to URLs with mv_pc or mv_source set to an
affiliate code are redirected to the same URL minus the affiliate code.
This keeps search engines that respect redirects from storing the affiliate
code-salted URL in their indexes, and helps them focus on the real resource
with a single URL instead of a multitude of salted links.
It has the side-effect of causing regular users following an affiliate
link to land on a URL with no affiliate code but instead with a session
ID in it, if they didn't have a session cookie already. There's no
easy way around this, and I consider it a separate issue from the
BounceReferrals concept that either happens one the first page with
BounceReferrals, or the second page without it. Either way, if session
IDs in URLs are a concern, it'll need a separate solution.
(Historically, many application servers always bounce the first request
to check for cookie support. Nowadays, many simply require cookies for
anything that needs a session. Interchange is different on both counts.)
Revision Changes Path
2.218 +3 -2 interchange/lib/Vend/Config.pm
rev 2.218, prev_rev 2.217
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.217
retrieving revision 2.218
diff -u -u -r2.217 -r2.218
--- Config.pm 12 Jun 2007 15:55:49 -0000 2.217
+++ Config.pm 27 Jun 2007 22:42:36 -0000 2.218
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.217 2007/06/12 15:55:49 mheins Exp $
+# $Id: Config.pm,v 2.218 2007/06/27 22:42:36 jon Exp $
#
# Copyright (C) 2002-2007 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
use Vend::Data;
use Vend::Cron;
-$VERSION = substr(q$Revision: 2.217 $, 10);
+$VERSION = substr(q$Revision: 2.218 $, 10);
my %CDname;
my %CPname;
@@ -699,6 +699,7 @@
['CartTriggerQuantity', 'yesno', 'no'],
['UserTrack', 'yesno', 'yes'],
['DebugHost', 'ip_address_regexp', ''],
+ ['BounceReferrals', 'yesno', 'no'],
];
1.77 +32 -6 interchange/lib/Vend/Dispatch.pm
rev 1.77, prev_rev 1.76
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -u -r1.76 -r1.77
--- Dispatch.pm 10 Jun 2007 02:15:34 -0000 1.76
+++ Dispatch.pm 27 Jun 2007 22:42:36 -0000 1.77
@@ -1,6 +1,6 @@
# Vend::Dispatch - Handle Interchange page requests
#
-# $Id: Dispatch.pm,v 1.76 2007/06/10 02:15:34 jon Exp $
+# $Id: Dispatch.pm,v 1.77 2007/06/27 22:42:36 jon Exp $
#
# Copyright (C) 2002-2006 Interchange Development Group
# Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
package Vend::Dispatch;
use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.76 $, 10);
+$VERSION = substr(q$Revision: 1.77 $, 10);
use POSIX qw(strftime);
use Vend::Util;
@@ -1409,13 +1409,39 @@
$Vend::Session->{'arg'} = $Vend::Argument = ($CGI::values{mv_arg} || undef);
+ my $new_source;
if ($CGI::values{mv_pc} and $CGI::values{mv_pc} =~ /\D/) {
- $Vend::Session->{source} = $CGI::values{mv_pc} eq 'RESET'
- ? ''
- : $CGI::values{mv_pc};
+ $new_source = $Vend::Session->{source} = $CGI::values{mv_pc} eq 'RESET'
+ ? ''
+ : $CGI::values{mv_pc};
}
elsif($CGI::values{mv_source}) {
- $Vend::Session->{source} = $CGI::values{mv_source};
+ $new_source = $Vend::Session->{source} = $CGI::values{mv_source};
+ }
+ if ($new_source and $CGI::request_method eq 'GET' and $Vend::Cfg->{BounceReferrals}) {
+ my $path = $CGI::path_info;
+ $path =~ s:^/::;
+ my $form =
+ join '',
+ map { "$_=$CGI::values{$_}\n" }
+ sort keys %$CGI::values;
+ my $url = vendUrl($path, undef, undef, { form => $form, match_security => 1 });
+ my $msg = get_locale_message(
+ 302,
+ "Redirected to %s.",
+ $url,
+ );
+ $Vend::StatusLine = <<EOF;
+Status: 302 Moved
+Location: $url
+Content-Type: text/plain
+
+Redirecting to $url
+EOF
+ response($msg);
+#::logDebug("bouncing to $url");
+ close_cat();
+ return;
}
$Vend::Session->{'user'} = $CGI::user;
More information about the interchange-cvs
mailing list