summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormyk%mozilla.org <>2006-08-09 10:30:27 +0200
committermyk%mozilla.org <>2006-08-09 10:30:27 +0200
commitd3560b444882a2e39d85b79610b6b47d88edb7e4 (patch)
tree856ba3510a82ab50e34303b79452922ebcfa2411
parentc912888237c96e5de3c0e73e68cac1dfddb2f556 (diff)
downloadbugzilla-d3560b444882a2e39d85b79610b6b47d88edb7e4.tar.gz
bugzilla-d3560b444882a2e39d85b79610b6b47d88edb7e4.tar.xz
Bug 347228: turn off server push and setting cookies when X-Moz request header set to "microsummary"
r=lpsolit a=myk
-rwxr-xr-xbuglist.cgi14
1 files changed, 11 insertions, 3 deletions
diff --git a/buglist.cgi b/buglist.cgi
index aacf6a466..e5fe4ef37 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -111,6 +111,13 @@ if ((defined $cgi->param('ctype')) && ($cgi->param('ctype') eq "js")) {
Bugzilla->logout_request();
}
+# An agent is a program that automatically downloads and extracts data
+# on its user's behalf. If this request comes from an agent, we turn off
+# various aspects of bug list functionality so agent requests succeed
+# and coexist nicely with regular user requests. Currently the only agent
+# we know about is Firefox's microsummary feature.
+my $agent = ($cgi->http('X-Moz') && $cgi->http('X-Moz') =~ /\bmicrosummary\b/);
+
# Determine the format in which the user would like to receive the output.
# Uses the default format if the user did not specify an output format;
# otherwise validates the user's choice against the list of available formats.
@@ -134,8 +141,9 @@ my $serverpush =
&& $ENV{'HTTP_USER_AGENT'} =~ /Mozilla.[3-9]/
&& (($ENV{'HTTP_USER_AGENT'} !~ /[Cc]ompatible/) || ($ENV{'HTTP_USER_AGENT'} =~ /MSIE 5.*Mac_PowerPC/))
&& $ENV{'HTTP_USER_AGENT'} !~ /WebKit/
- && !defined($cgi->param('serverpush'))
- || $cgi->param('serverpush');
+ && !$agent
+ && !defined($cgi->param('serverpush'))
+ || $cgi->param('serverpush');
my $order = $cgi->param('order') || "";
my $order_from_cookie = 0; # True if $order set using the LASTORDER cookie
@@ -1143,7 +1151,7 @@ $vars->{'defaultsavename'} = $cgi->param('query_based_on');
my $contenttype;
my $disp = "inline";
-if ($format->{'extension'} eq "html") {
+if ($format->{'extension'} eq "html" && !$agent) {
if ($order) {
$cgi->send_cookie(-name => 'LASTORDER',
-value => $order,