You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <Ke...@Golux.Com> on 2002/08/12 19:00:55 UTC

[PATCH] Workaround for bogobrowsers

Some browsers have an unusual breakage: when they receive a
redirect, and the redirect response's content-type includes a
charset, they remember the charset and apply it to the target
of the redirection -- overriding any charset the target's
response specifies.

This gets tickled when the redirect is coming out of any
internal Apache mechanism, since we explicitly set the
charset on those.  If the redirect is to a page in Greek,
for instance, the browser is going to try to render it in
iso-8859-1.

This is a client bug to be sure, but in a widely-deployed
browser: Netscape 4.

The following patch allows this to be worked around using our
standard BrowserMatch envariable mechanism.  It's against
1.3, since that's the version with the most penetration at
the moment and where the problem is most visible.

Index: src/main/http_protocol.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.325
diff -u -r1.325 http_protocol.c
--- src/main/http_protocol.c    9 Jul 2002 15:26:26 -0000       1.325
+++ src/main/http_protocol.c    12 Aug 2002 16:24:39 -0000
@@ -2834,7 +2834,13 @@
         r->content_languages = NULL;
         r->content_encoding = NULL;
         r->clength = 0;
-        r->content_type = "text/html; charset=iso-8859-1";
+        if (ap_table_get(r->subprocess_env,
+                         "suppress-error-charset") != NULL) {
+            r->content_type = "text/html";
+        }
+        else {
+            r->content_type = "text/html; charset=iso-8859-1";
+        }
 
         if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
             ap_table_setn(r->headers_out, "Allow", make_allow(r));

-- 
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"

Re: [PATCH] Workaround for bogobrowsers

Posted by "johannes m. richter" <jo...@gmx.net>.
> > The following patch allows this to be worked around using our
> > standard BrowserMatch envariable mechanism.  It's against
> > 1.3, since that's the version with the most penetration at
> > the moment and where the problem is most visible.
>
>+1 with the caveat that this needs to go into 2.0 too.  -- justin

Attached is a proposed patch against 2.0.40 (nearly the same as for 1.3..)
(i hope the patch format is ok - diff -u on windows)

--- src/modules/http/http_protocol-old.c        Sun Aug 04 11:24:10 2002
+++ src/modules/http/http_protocol.c    Mon Aug 12 20:27:37 2002
@@ -2261,7 +2261,13 @@
          r->content_languages = NULL;
          r->content_encoding = NULL;
          r->clength = 0;
-        ap_set_content_type(r, "text/html; charset=iso-8859-1");
+
+        if (apr_table_get(r->subprocess_env, "suppress-error-charset") != 
NULL) {
+            ap_set_content_type(r, "text/html");
+        }
+        else {
+            ap_set_content_type(r, "text/html; charset=iso-8859-1");
+        }

          if ((status == HTTP_METHOD_NOT_ALLOWED)
              || (status == HTTP_NOT_IMPLEMENTED)) {


-- 
If you're on your own in this life, the days and nights are long
   -- REM, "Everybody Hurts"
- http://jgcl.at/ko/ - new photos from summer camp 2002 in Moosen/Tirol


Re: [PATCH] Workaround for bogobrowsers

Posted by Justin Erenkrantz <je...@apache.org>.
On Mon, Aug 12, 2002 at 01:00:55PM -0400, Rodent of Unusual Size wrote:
> The following patch allows this to be worked around using our
> standard BrowserMatch envariable mechanism.  It's against
> 1.3, since that's the version with the most penetration at
> the moment and where the problem is most visible.

+1 with the caveat that this needs to go into 2.0 too.  -- justin

Re: [PATCH] Workaround for bogobrowsers

Posted by Joshua Slive <jo...@slive.ca>.
Jim Jagielski wrote:
> By the by, do we have a canonical list of such env-vars currently is use?
> Last I checked, the doccos were somewhat dated and sparse.

The canonical list is here:
http://httpd.apache.org/docs/env.html#special
(and similarly for 2.0)

But I believe that some of the recent additions have not made it into 
the right place.

Joshua.


RE: [PATCH] Workaround for bogobrowsers

Posted by Jim Jagielski <ji...@jaguNET.com>.
By the by, do we have a canonical list of such env-vars currently is use?
Last I checked, the doccos were somewhat dated and sparse.
-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

RE: [PATCH] Workaround for bogobrowsers

Posted by Cliff Woolley <jw...@virginia.edu>.
On Mon, 12 Aug 2002, Jim Jagielski wrote:

> >> The following patch allows this to be worked around using our
> >> standard BrowserMatch envariable mechanism.  It's against
> >> 1.3, since that's the version with the most penetration at
> > > the moment and where the problem is most visible.

likewise +1


RE: [PATCH] Workaround for bogobrowsers

Posted by Jim Jagielski <ji...@jaguNET.com>.
+1 here as well.

At 1:55 PM -0400 8/12/02, Bill Stoddard wrote:
>+1
>
> >
>> The following patch allows this to be worked around using our
>> standard BrowserMatch envariable mechanism.  It's against
>> 1.3, since that's the version with the most penetration at
> > the moment and where the problem is most visible.
>>

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

RE: [PATCH] Workaround for bogobrowsers

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
yes please !

+1


> > redirect, and the redirect response's content-type includes a
> > charset, they remember the charset and apply it to the target
> > of the redirection -- overriding any charset the target's
> > response specifies.
> >
> > This gets tickled when the redirect is coming out of any
> > internal Apache mechanism, since we explicitly set the
> > charset on those.  If the redirect is to a page in Greek,
> > for instance, the browser is going to try to render it in
> > iso-8859-1.
> >
> > This is a client bug to be sure, but in a widely-deployed
> > browser: Netscape 4.
> >
> > The following patch allows this to be worked around using our
> > standard BrowserMatch envariable mechanism.  It's against
> > 1.3, since that's the version with the most penetration at
> > the moment and where the problem is most visible.
> >
> > Index: src/main/http_protocol.c
> > ===================================================================
> > RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
> > retrieving revision 1.325
> > diff -u -r1.325 http_protocol.c
> > --- src/main/http_protocol.c    9 Jul 2002 15:26:26 -0000       1.325
> > +++ src/main/http_protocol.c    12 Aug 2002 16:24:39 -0000
> > @@ -2834,7 +2834,13 @@
> >          r->content_languages = NULL;
> >          r->content_encoding = NULL;
> >          r->clength = 0;
> > -        r->content_type = "text/html; charset=iso-8859-1";
> > +        if (ap_table_get(r->subprocess_env,
> > +                         "suppress-error-charset") != NULL) {
> > +            r->content_type = "text/html";
> > +        }
> > +        else {
> > +            r->content_type = "text/html; charset=iso-8859-1";
> > +        }
> >
> >          if ((status == METHOD_NOT_ALLOWED) || (status ==
> > NOT_IMPLEMENTED))
> >              ap_table_setn(r->headers_out, "Allow", make_allow(r));
> >
> > --
> > #ken	P-)}
> >
> > Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
> > Author, developer, opinionist      http://Apache-Server.Com/
> >
> > "Millennium hand and shrimp!"
> >
>


RE: [PATCH] Workaround for bogobrowsers

Posted by Bill Stoddard <bi...@wstoddard.com>.
+1

> Some browsers have an unusual breakage: when they receive a
> redirect, and the redirect response's content-type includes a
> charset, they remember the charset and apply it to the target
> of the redirection -- overriding any charset the target's
> response specifies.
> 
> This gets tickled when the redirect is coming out of any
> internal Apache mechanism, since we explicitly set the
> charset on those.  If the redirect is to a page in Greek,
> for instance, the browser is going to try to render it in
> iso-8859-1.
> 
> This is a client bug to be sure, but in a widely-deployed
> browser: Netscape 4.
> 
> The following patch allows this to be worked around using our
> standard BrowserMatch envariable mechanism.  It's against
> 1.3, since that's the version with the most penetration at
> the moment and where the problem is most visible.
> 
> Index: src/main/http_protocol.c
> ===================================================================
> RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
> retrieving revision 1.325
> diff -u -r1.325 http_protocol.c
> --- src/main/http_protocol.c    9 Jul 2002 15:26:26 -0000       1.325
> +++ src/main/http_protocol.c    12 Aug 2002 16:24:39 -0000
> @@ -2834,7 +2834,13 @@
>          r->content_languages = NULL;
>          r->content_encoding = NULL;
>          r->clength = 0;
> -        r->content_type = "text/html; charset=iso-8859-1";
> +        if (ap_table_get(r->subprocess_env,
> +                         "suppress-error-charset") != NULL) {
> +            r->content_type = "text/html";
> +        }
> +        else {
> +            r->content_type = "text/html; charset=iso-8859-1";
> +        }
>  
>          if ((status == METHOD_NOT_ALLOWED) || (status == 
> NOT_IMPLEMENTED))
>              ap_table_setn(r->headers_out, "Allow", make_allow(r));
> 
> -- 
> #ken	P-)}
> 
> Ken Coar, Sanagendamgagwedweinini  http://Golux.Com/coar/
> Author, developer, opinionist      http://Apache-Server.Com/
> 
> "Millennium hand and shrimp!"
>