From: Dave Lawrence Date: Wed, 3 Mar 2010 21:59:18 +0000 (-0500) Subject: Bug 513989 - large search query causing internal server error (500) but valid redirec... X-Git-Tag: bugzilla-3.6rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=912928873ae5f555a6abff18bf6c19ce2c0da2e5;p=thirdparty%2Fbugzilla.git Bug 513989 - large search query causing internal server error (500) but valid redirect 302 returned r=mkanat,a=mkanat --- diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 20926fab05..18772878a6 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -171,6 +171,8 @@ use File::Basename; PASSWORD_DIGEST_ALGORITHM PASSWORD_SALT_LENGTH + + CGI_URI_LIMIT ); @Bugzilla::Constants::EXPORT_OK = qw(contenttypes); @@ -495,6 +497,11 @@ use constant PASSWORD_DIGEST_ALGORITHM => 'SHA-256'; # of your users will be able to log in until they reset their passwords. use constant PASSWORD_SALT_LENGTH => 8; +# Certain scripts redirect to GET even if the form was submitted originally +# via POST such as buglist.cgi. This value determines whether the redirect +# can be safely done or not based on the web server's URI length setting. +use constant CGI_URI_LIMIT => 10000; + sub bz_locations { # We know that Bugzilla/Constants.pm must be in %INC at this point. # So the only question is, what's the name of the directory diff --git a/buglist.cgi b/buglist.cgi index afe37dfdbc..d9b19dc007 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -85,9 +85,11 @@ if (grep { $_ =~ /^cmd\-/ } $cgi->param()) { # if ($cgi->request_method() eq 'POST') { $cgi->clean_search_url(); - - print $cgi->redirect(-url => $cgi->self_url()); - exit; + my $uri_length = length($cgi->self_url()); + if ($uri_length < CGI_URI_LIMIT) { + print $cgi->redirect(-url => $cgi->self_url()); + exit; + } } # Determine whether this is a quicksearch query.