mod_ruby triggers Bug in IE 6.0

"Hannes Wyss" <[email protected]> Fri, 19 May 2006 09:51:57 +0200
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Hi all

I've already posted this Bugreport on dev.modruby.net (5) - but either I
landed in the tarpit, or mine is the only non-spam entry in the
Bug-Tracker. So here goes again:

A Bug Internet Explorer 6.0 leads to a cryptic error message when a
XmlHttpRequest receives a Response with (lowercase) "Content-Type:
text/html; charset=3Dutf-8". This Bug does not show up when the charset is
given as (uppercase) "UTF-8" (1).

mod_ruby applies String::downcase to the content-type, and therewith
triggers that Bug (2).

Is there a reason for this? Afaik nothing in the relevant standards says
that charset encodings should be specified in lowercase - in fact the
default charset for HTTP 1.1 is defined as (uppercase) 'ISO-8859-1'
(3,4). If possible, I would be grateful if that line could be removed
from the code :)

Thanks in advance, and thank you very much indeed for giving the world
mod_ruby!

Hannes

1) http://www.panoramio.com/blog/explorer-system-error-1072896658/

2) mod_ruby-1.2.5/request.c:643-659

static VALUE request_set_content_type(VALUE self, VALUE str)
{
    request_data *data;

    data =3D get_request_data(self);
    if (NIL_P(str)) {
        data->request->content_type =3D NULL;
    }
    else {
        Check_Type(str, T_STRING);
        str =3D rb_funcall(str, rb_intern("downcase"), 0);
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        data->request->content_type =3D
            apr_pstrndup(data->request->pool,
                        RSTRING(str)->ptr, RSTRING(str)->len);
    }
    return str;
}

3) http://www.w3.org/International/O-HTTP-charset
4) http://www.w3.org/Protocols/rfc2068/rfc2068.txt
5) http://dev.modruby.net/tickets/show/140