From 3f4bb50b019115eb59282928c7eea99c3d2a7b2d Mon Sep 17 00:00:00 2001 From: short <> Date: Thu, 25 Aug 2005 01:00:05 +0000 Subject: [PATCH] Fixed fallback on failed content negotiations. +Support: $W->{"xml_header_only"}; Cosmetic: Cleanup retrieval: $W->{"language"} --- Web.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Web.pm b/Web.pm index f67c47d..3eb176b 100644 --- a/Web.pm +++ b/Web.pm @@ -654,7 +654,7 @@ my($self,$variants)=@_; # Do not: HTTP::Headers->new($W->{"r"}->headers_in()); # to prevent empty result or even: Odd number of elements in anonymous hash HTTP::Headers->new(%{$W->{"r"}->headers_in()})); - $best||=$variants->[0]{"id"}; # &HTTP::Negotiate::choose failed? + $best||=$variants->[0][0]; # $variants->[0]{"id"}; &HTTP::Negotiate::choose failed? return $best; } @@ -783,7 +783,6 @@ my($class)=@_; # FIXME: It is not clean to still append them without overwriting. return if $W->{"heading_done"}++; - my $lang=($W->{"language"}||"en-US"); # Workaround bug # https://bugzilla.mozilla.org/show_bug.cgi?id=120556 # of at least @@ -803,22 +802,23 @@ my($class)=@_; "content-type"=>"text/html", "qs"=>0.6, "charset"=>$client_charset, - "lang"=>$lang, + "lang"=>$W->{"language"}, ), negotiate_variant( "id"=>"application/xhtml+xml", "content-type"=>"application/xhtml+xml", "qs"=>0.6, "charset"=>$client_charset, - "lang"=>$lang, + "lang"=>$W->{"language"}, ), # application/xml ? # text/xml ? ]); $W->{"r"}->content_type("$mime; charset=$client_charset"); Wprint ''."\n" if $mime=~m{^application/\w+[+]xml$}; + return if $W->{"xml_header_only"}; Wprint ''."\n"; - Wprint ''."\n"; + Wprint ''."\n"; my $title=$W->{"title_prefix"}.join("",map({ ': '.$_; } ($W->{"title"} || ()))); $title=~s#<[^>]*>##g; Wprint ""; -- 1.8.3.1