Assume "image/svg+xml" support for Firefox-1.5.
authorshort <>
Mon, 5 Dec 2005 13:53:03 +0000 (13:53 +0000)
committershort <>
Mon, 5 Dec 2005 13:53:03 +0000 (13:53 +0000)
 - Not passed as SVG is not supported from <img /> elements.

svg-gecko-force.patch [new file with mode: 0644]

diff --git a/svg-gecko-force.patch b/svg-gecko-force.patch
new file mode 100644 (file)
index 0000000..886bd36
--- /dev/null
@@ -0,0 +1,81 @@
+Index: Web.pm
+===================================================================
+RCS file: /home/short/pserver/cvs/MyWeb/Web.pm,v
+retrieving revision 1.15
+diff -u -p -r1.15 Web.pm
+--- Web.pm     10 Nov 2005 06:39:24 -0000      1.15
++++ Web.pm     5 Dec 2005 13:51:46 -0000
+@@ -204,11 +204,44 @@ my($class,%args)=@_;
+       $W->{"headers_in"}=$W->{"r"}->headers_in();
+       Wrequire 'My::Hash::Merge';
++      my $headers_in_orig=$W->{"headers_in"};
+       $W->{"headers_in"}=My::Hash::Merge->new(
+-                      $W->{"headers_in"},
++                      # Proper ordering - "Accept" is overriding!
+                       My::Hash::Sub->new({
+                               "_remote_ip"=>sub { return $W->{"r"}->connection()->remote_ip(); },
++                              "Accept"=>sub {
++                                      return our $r||=do {
++                                              my $accept_string=$headers_in_orig->{"Accept"};
++                                              if ($accept_string && (my $gecko_version=$W->{"browser"}->gecko_version())) {
++                                                      # Since Gecko "rv:1.8", that means since Firefox-1.5.
++                                                      if ("001-008" le join("-",map((sprintf("%03d",$_)),split(/[.]/,$gecko_version)))) {
++                                                              my $http_headers=HTTP::Headers->new($accept_string);
++                                                              my $format=HTTP::Negotiate::choose([
++                                                                      [
++                                                                              "image/catch-missing-svg-type",  # ID
++                                                                              0.9,  # QS
++                                                                              "image/catch-missing-svg-type",  # Content-Type
++                                                                              ],
++                                                                      [
++                                                                              "image/svg+xml",  # ID
++                                                                              0.8,  # QS
++                                                                              "image/svg+xml",  # Content-Type
++                                                                              ],
++                                                                      ],$http_headers);
++                                                              if ($format && $format eq "image/catch-missing-svg-type") {
++                                                                      # Image requests: "image/png,*/*;q=0.5"
++                                                                      # and thus "image/png" is assigned the same priority.
++                                                                      # FIXME: RFC 2068 (HTTP/1.1) does not specify the behavior!
++                                                                      #        HTTP::Negotiate fortunately follows the ordering preferences.
++                                                                      $accept_string="image/svg+xml,".$accept_string;
++                                                                      }
++                                                              }
++                                                      }
++                                              $accept_string;
++                                              };
++                                      },
+                               }),
++                      $W->{"headers_in"},
+                       );
+       Wrequire 'My::Hash::Readonly';
+       $W->{"headers_in"}=My::Hash::Readonly->new($W->{"headers_in"});
+Index: Hash/Merge.pm
+===================================================================
+RCS file: /home/short/pserver/cvs/MyWeb/Hash/Merge.pm,v
+retrieving revision 1.1
+diff -u -p -r1.1 Merge.pm
+--- Hash/Merge.pm      18 Sep 2005 06:43:14 -0000      1.1
++++ Hash/Merge.pm      5 Dec 2005 13:51:46 -0000
+@@ -40,19 +40,16 @@ my($class,@parents)=@_;
+       return $self;
+ }
++# Multiplicity is permitted, first one is chosen.
+ sub key_find($$)
+ {
+ my($self,$key)=@_;
+-      my $count=0;
+       my $first;
+       for my $parent (@{$self->{"parents"}}) {
+               next if !exists $parent->{$key};
+-              $count++;
+               $first||=$parent;
+               }
+-      # 0 IS allowed here.
+-      cluck "Duplicity ($count-icity) for key: $key" if $count>=2;
+       $first||=$self->{"parents"}[0];
+       return $first;
+ }