Re: Apache 2.0.34-dev Sends Wrong Content-Type

2002-03-10 Thread Jerry Baker

"William A. Rowe, Jr." wrote:
> 
> Jerry Baker wrote:
> > Apache 2.0.33-dev (from CVS today) crashes if I request a non-existent
> > file.
> 
> Filtering just changed significantly... fixed as of this morning [late
> last evening, actually.
> 
> Please try cvs up and if you can repeat, email [EMAIL PROTECTED]
> 
> Thanks Jerry!

Apache 2.0.34-dev pulled from CVS today is sending text/plain as the
content-type on 404 responses. See example below:

HTTP/1.1 404 Not Found
Date: Thu, 07 Mar 2002 21:23:10 GMT
Server: Apache/2.0.34-dev (Win32)
Vary: accept-language
Content-Length: 794
Connection: close
Content-Type: text/plain; charset=ISO-8859-1

This, or course, makes the 404 response appear as a screen full of HTML
code instead of how it should.

-- 
Jerry Baker



Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-08 Thread sterling

On Thu, 7 Mar 2002, Justin Erenkrantz wrote:

> On Thu, Mar 07, 2002 at 08:57:42PM -0800, [EMAIL PROTECTED] wrote:
> > well, the workaround is to set DefaultType text/html.  The real problem, 
> > however, seems to be the fact that only the subrequest gets the content 
> > type set to text/html in this case, while the main request still has the 
> > content_type set to NULL (hence it uses the default).
> > 
> > I'll work on a patch that properly sets the content type to the type in 
> > the var file.
> 
> Shouldn't the subreq's content-type be propogated upwards when we
> do the fast_redirect?  -- justin


I would think so, but on first look the r->content_type=text/html but the 
request that gets passed through the filter at the end 
r->content_type=NULL.

I'll keep looking at it later.  I did notice that if I manually set 
r->prev->content_type=mime_info.mime_type then everything 'just works' 
(but is a hack like the following):

Index: modules/mappers/mod_negotiation.c
===
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_negotiation.c,v
retrieving revision 1.95
diff -u -r1.95 mod_negotiation.c
--- modules/mappers/mod_negotiation.c   13 Feb 2002 02:55:17 -  1.95
+++ modules/mappers/mod_negotiation.c   8 Mar 2002 18:13:34 -
@@ -939,6 +939,8 @@
 
 get_entry(neg->pool, &accept_info, body);
 set_mime_fields(&mime_info, &accept_info);
+if( r->prev )
+r->prev->content_type = mime_info.mime_type;
 has_content = 1;
 }
 else if (!strncmp(buffer, "content-length:", 15)) {




Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Justin Erenkrantz

On Thu, Mar 07, 2002 at 08:57:42PM -0800, [EMAIL PROTECTED] wrote:
> well, the workaround is to set DefaultType text/html.  The real problem, 
> however, seems to be the fact that only the subrequest gets the content 
> type set to text/html in this case, while the main request still has the 
> content_type set to NULL (hence it uses the default).
> 
> I'll work on a patch that properly sets the content type to the type in 
> the var file.

Shouldn't the subreq's content-type be propogated upwards when we
do the fast_redirect?  -- justin




Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread sterling

On Thu, 7 Mar 2002, Jerry Baker wrote:

> [EMAIL PROTECTED] wrote:
> > 
> > On Thu, 7 Mar 2002, Jerry Baker wrote:
> > 
> > > Do you think that Apache is not reading the HTTP_NOT_FOUND.html.var file
> > > correctly which explicitly states that it should be text/html?
> > 
> > is it showing the content from that var file?  what is the content you are
> > seeing (the plain html).
> > 
> > sterling
> 
> Straight out of the var file (from the "en" section).


well, the workaround is to set DefaultType text/html.  The real problem, 
however, seems to be the fact that only the subrequest gets the content 
type set to text/html in this case, while the main request still has the 
content_type set to NULL (hence it uses the default).

I'll work on a patch that properly sets the content type to the type in 
the var file.

sterling




Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Jerry Baker

[EMAIL PROTECTED] wrote:
> 
> On Thu, 7 Mar 2002, Jerry Baker wrote:
> 
> > Do you think that Apache is not reading the HTTP_NOT_FOUND.html.var file
> > correctly which explicitly states that it should be text/html?
> 
> is it showing the content from that var file?  what is the content you are
> seeing (the plain html).
> 
> sterling

HTML
-



Object not found!
mailto:[EMAIL PROTECTED]";>



Object not found!




The requested URL was not found on this server.

  

If you entered the URL manually please check your
spelling and try again.

  


 If you think this is a server error, please contact
 the mailto:[EMAIL PROTECTED]";>webmaster



Error 404



  jerbaker.dhs.org
  
  
  03/07/02 21:01:42
  
  Apache/2.0.34-dev (Win32)




--

-- 
Jerry Baker



Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Jerry Baker

[EMAIL PROTECTED] wrote:
> 
> On Thu, 7 Mar 2002, Jerry Baker wrote:
> 
> > Do you think that Apache is not reading the HTTP_NOT_FOUND.html.var file
> > correctly which explicitly states that it should be text/html?
> 
> is it showing the content from that var file?  what is the content you are
> seeing (the plain html).
> 
> sterling

Straight out of the var file (from the "en" section).

-- 
Jerry Baker



Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread sterling

On Thu, 7 Mar 2002, Jerry Baker wrote:

> Do you think that Apache is not reading the HTTP_NOT_FOUND.html.var file
> correctly which explicitly states that it should be text/html?

is it showing the content from that var file?  what is the content you are 
seeing (the plain html).

sterling




Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Jerry Baker

[EMAIL PROTECTED] wrote:
> 
> I think this is a general problem with get_canned_error_string - something
> like the following should fix that

Do you think that Apache is not reading the HTTP_NOT_FOUND.html.var file
correctly which explicitly states that it should be text/html?

-- 
Jerry Baker



Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Jerry Baker

[EMAIL PROTECTED] wrote:
> 
> I think this is a general problem with get_canned_error_string - something
> like the following should fix that

This patch does not appear to remedy the problem here on Win32.

-- 
Jerry Baker



Re: [PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Aaron Bannert

On Thu, Mar 07, 2002 at 05:43:20PM -0800, John Sterling wrote:
> I think this is a general problem with get_canned_error_string - something 
> like the following should fix that
> 
> 
> Index: modules/http/http_protocol.c
> ===
> RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
> retrieving revision 1.393
> diff -u -r1.393 http_protocol.c
> --- modules/http/http_protocol.c  4 Mar 2002 05:54:44 -   1.393
> +++ modules/http/http_protocol.c  8 Mar 2002 01:42:06 -
> @@ -1618,6 +1618,7 @@
>  apr_pool_t *p = r->pool;
>  const char *error_notes, *h1, *s1;
>  
> +r->content_type = "text/html";
>  switch (status) {
>  case HTTP_MOVED_PERMANENTLY:
>  case HTTP_MOVED_TEMPORARILY:

John posted this patch awhile ago. I'm +1 and will commit in 24 hours
unless someone speaks up with a reason not to.

-aaron



[PATCH] Re: Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread sterling

On Thu, 7 Mar 2002, Jerry Baker wrote:

> Apache 2.0.34-dev pulled from CVS today is sending text/plain as the
> content-type on 404 responses. See example below:
> 
> HTTP/1.1 404 Not Found
> Date: Thu, 07 Mar 2002 21:23:10 GMT
> Server: Apache/2.0.34-dev (Win32)
> Vary: accept-language
> Content-Length: 794
> Connection: close
> Content-Type: text/plain; charset=ISO-8859-1
> 
> This, or course, makes the 404 response appear as a screen full of HTML
> code instead of how it should.


I think this is a general problem with get_canned_error_string - something 
like the following should fix that


Index: modules/http/http_protocol.c
===
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.393
diff -u -r1.393 http_protocol.c
--- modules/http/http_protocol.c4 Mar 2002 05:54:44 -   1.393
+++ modules/http/http_protocol.c8 Mar 2002 01:42:06 -
@@ -1618,6 +1618,7 @@
 apr_pool_t *p = r->pool;
 const char *error_notes, *h1, *s1;
 
+r->content_type = "text/html";
 switch (status) {
 case HTTP_MOVED_PERMANENTLY:
 case HTTP_MOVED_TEMPORARILY:




Apache 2.0.34-dev Sends Wrong Content-Type on 404

2002-03-07 Thread Jerry Baker

Apache 2.0.34-dev pulled from CVS today is sending text/plain as the
content-type on 404 responses. See example below:

HTTP/1.1 404 Not Found
Date: Thu, 07 Mar 2002 21:23:10 GMT
Server: Apache/2.0.34-dev (Win32)
Vary: accept-language
Content-Length: 794
Connection: close
Content-Type: text/plain; charset=ISO-8859-1

This, or course, makes the 404 response appear as a screen full of HTML
code instead of how it should.

-- 
Jerry Baker