[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#599425: packages.d.o: do not say 200 OK on errors



tags 599425 +patch
thanks

Hi,

On Thu, Oct 07, 2010 at 04:49:08PM +0200, Peter Palfrader wrote:
> Package: www.debian.org
> Severity: normal
> 
> packages.d.o (and archive.d.n) say 200 OK even on errors.
> 
> e.g.:
> | weasel@intrepid:~$ wget -S  http://packages.debian.org/debian-volatile/dists/etch/volatile/main/source/Sources.bz2
> | --2010-10-07 16:48:10--  http://packages.debian.org/debian-volatile/dists/etch/volatile/main/source/Sources.bz2
> | Resolving packages.debian.org... 194.177.211.202, 87.106.64.223, 128.31.0.49, ...
> | Connecting to packages.debian.org|194.177.211.202|:80... connected.
> | HTTP request sent, awaiting response... 
> |   HTTP/1.1 200 OK
> | ^^^^^^^^^^^^^^^^^^
> |   Date: Thu, 07 Oct 2010 14:48:11 GMT
> |   Server: Apache
> 
> The document itself then says '<title>Debian -- Error</title>' but that's not
> really enough.

Such cases are actually planned by current code, but were not used.

However with the working patch attached (using something else than default
200):
- it leads the message error to be bare apache styled, so the only solution to
  that would be apache configuration (including l10n) using static files built
from templates.
- the message error itself is my default the default apache one, unless
  specifed otherwise: either we can do it by default in fatal_error function,
  or at each call (more conservative solution).

-- 
Simon Paillard
>From 54ec14a940dd27f0e4506d8c43c6939aaae47d37 Mon Sep 17 00:00:00 2001
From: Simon Paillard <spaillard@debian.org>
Date: Sun, 27 Mar 2011 21:42:26 +0200
Subject: [PATCH] Call fatal_error with relevant HTTP error code (Closes: #599425)

---
 lib/Packages/Dispatcher.pm |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/Packages/Dispatcher.pm b/lib/Packages/Dispatcher.pm
index 08c6f96..24cf622 100755
--- a/lib/Packages/Dispatcher.pm
+++ b/lib/Packages/Dispatcher.pm
@@ -172,7 +172,7 @@ sub do_dispatch {
 	    shift @components;
 	    $what_to_do = 'search';
 	    # Done
-	    fatal_error( "search doesn't take any more path elements" )
+	    fatal_error( "search doesn't take any more path elements" , 400 )
 		if @components;
 	} elsif (@components == 0) {
 	    fatal_error( "We're supposed to display the homepage here, instead of getting dispatch.pl" );
@@ -202,7 +202,7 @@ sub do_dispatch {
 		my ($cgi, $params_set, $key, $val) = @_;
 		debug("set_param_once key=$key val=$val",4) if DEBUG;
 		if ($params_set->{$key}++) {
-		    fatal_error( "$key set more than once in path" );
+		    fatal_error( "$key set more than once in path" , 400 );
 		} else {
 		    $cgi->param( $key, $val );
 		}
@@ -237,7 +237,7 @@ sub do_dispatch {
 	    @components = @pkg;
 
 	    if (@components > 1) {
-		fatal_error( "two or more packages specified (@components)" );
+		fatal_error( "two or more packages specified (@components)" , 400 );
 	    }
 	} # else if (@components == 1)
 
-- 
1.7.2.5


Reply to: