You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modproxy-dev@apache.org by Matthias Kurz <mk...@baerlap.north.de> on 2002/06/30 12:21:41 UTC

1.3.26 and missing Content-Type

Hi.

Users reported a problem with pages like
    http://cgi3.ebay.de/aw-cgi/eBayISAPI.dll?SignIn

Problems: Crippled header and missing Content-Type.
As far as i can see, the missing Content-Type leads to the usage of
the DefaultType from httpd.conf. This is usually "text/plain" and leads
to the effect that the HTML code is not interpreted but displayed as
plain text.
Changing the DefaultType in httpd.conf to "text/html" leads to the problem,
that some plain text documents (e.g. README on ftp sites) are displayed as
"HTML" which looks rather ugly.

After i unsuccessfully tried to fiddle with "mime.types" and "magic", i 
applied the following hack:

--- tmp/apache_1.3.26/src/modules/proxy/proxy_http.c    Tue Jun 18 02:59:59 2002
+++ proxy_http.c        Sun Jun 30 11:41:17 2002
@@ -590,6 +590,9 @@
                                ap_get_server_name(r), NULL));
     /* The Content-Type of this response is the upstream one. */
     r->content_type = ap_table_get(r->headers_out, "Content-Type");
+    if (r->content_type == NULL) {
+        r->content_type = "text/html";
+    }
     ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server, "Content-Type: %s", r->content_type);
 
     /* finally output the headers to the client */


Questions:
----------
- Will this work (it would make some sense for a http proxy, wouldn't it) ?
  Well, it looks like it fixes the main problem, but are there side effects ?
- Does the proxy really not care about "mime.types" and "magic" in case
  of a missing Content-Type ?
  I tried in "mime.types":
     text/html .dll .dll?SighIn
  and in "magic" (mod_mime_magic is compiled in):
     0       string          \074\150\164\155\154\076        text/html
                             ^^^ = <html>
- Is there another/better way to fix the problem (except asking eBay to
  fix their headers - nobody is availlable)
- Who else is responsible to "guess" a Content-Type ? Need it to be fixed
  there ?


  Thanks

   (mk)

-- 
Matthias Kurz; Fuldastr. 3; D-28199 Bremen; VOICE +49 421 53 600 47
   >> Im prämotorischen Cortex kann jeder ein Held sein. (bdw) <<

Re: 1.3.26 and missing Content-Type

Posted by Matthias Kurz <mk...@baerlap.north.de>.
On Sun, Jun 30, 2002 at 04:44:37PM +0200, Graham Leggett wrote:
> Matthias Kurz wrote:
> 
> > Users reported a problem with pages like
> >     http://cgi3.ebay.de/aw-cgi/eBayISAPI.dll?SignIn
> > 
> > Problems: Crippled header and missing Content-Type.
> > As far as i can see, the missing Content-Type leads to the usage of
> > the DefaultType from httpd.conf. This is usually "text/plain" and leads
> > to the effect that the HTML code is not interpreted but displayed as
> > plain text.
> 
> I investigated this a while back. According to RFC2616 (if memory 
> serves), the assumed Content-Type when it is missing is 
> application/octet-stream (and thus Apache is wrong to be sending 
> text/plain anyway).

It's at least configurable.

> However: the bug lies with Ebay's code, and I don't think we should be 
> breaking either Apache or RFC2616 simply because a website chooses to be 
> broken. :(

Understood. But why did (and do) older versions work ? Unfortunately
one cannot use an older version because of the latest security problems,
you know.


   (mk)

-- 
Matthias Kurz; Fuldastr. 3; D-28199 Bremen; VOICE +49 421 53 600 47
   >> Im prämotorischen Cortex kann jeder ein Held sein. (bdw) <<

Re: 1.3.26 and missing Content-Type

Posted by Graham Leggett <mi...@sharp.fm>.
Matthias Kurz wrote:

> Users reported a problem with pages like
>     http://cgi3.ebay.de/aw-cgi/eBayISAPI.dll?SignIn
> 
> Problems: Crippled header and missing Content-Type.
> As far as i can see, the missing Content-Type leads to the usage of
> the DefaultType from httpd.conf. This is usually "text/plain" and leads
> to the effect that the HTML code is not interpreted but displayed as
> plain text.

I investigated this a while back. According to RFC2616 (if memory 
serves), the assumed Content-Type when it is missing is 
application/octet-stream (and thus Apache is wrong to be sending 
text/plain anyway).

However: the bug lies with Ebay's code, and I don't think we should be 
breaking either Apache or RFC2616 simply because a website chooses to be 
broken. :(

Regards,
Graham
-- 
-----------------------------------------
minfrin@sharp.fm 
	"There's a moon
					over Bourbon Street
						tonight..."