Project

General

Profile

Actions

Bug #1298

closed

404 errors not processed properly

Added by Anonymous over 17 years ago. Updated over 17 years ago.

Status:
Fixed
Priority:
High
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

I'm using v1.4.16 via the redhat spec file, and am having trouble with the way lighttpd is processing 404 errors.

I've set "server.error-handler-404 = "/clear.gif"" in the config file (chrooted), but when I make a non-existent file request, it sends the 404 image (clear.gif), but also appends it with its internal error message and sends a text/html content-type head.

Here's the output I get:


GIF89a??€??ÀÀÀ???!ù????,???????D?;<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
 <body>
  <h1>404 - Not Found</h1>
 </body>

</html>

When running lighttpd with "debug.log-request-handling = "enable"", heres what I get in the logs:


2007-08-12 00:09:09: (response.c.205) -- splitting Request-URI
2007-08-12 00:09:09: (response.c.206) Request-URI  :  /nonexistingfile
2007-08-12 00:09:09: (response.c.207) URI-scheme   :  http
2007-08-12 00:09:09: (response.c.208) URI-authority:  127.0.0.1
2007-08-12 00:09:09: (response.c.209) URI-path     :  /nonexistingfile
2007-08-12 00:09:09: (response.c.210) URI-query    :
2007-08-12 00:09:09: (response.c.260) -- sanatising URI
2007-08-12 00:09:09: (response.c.261) URI-path     :  /nonexistingfile
2007-08-12 00:09:09: (response.c.375) -- before doc_root
2007-08-12 00:09:09: (response.c.376) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.377) Rel-Path     : /nonexistingfile
2007-08-12 00:09:09: (response.c.378) Path         :
2007-08-12 00:09:09: (response.c.426) -- after doc_root
2007-08-12 00:09:09: (response.c.427) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.428) Rel-Path     : /nonexistingfile
2007-08-12 00:09:09: (response.c.429) Path         : /www/nonexistingfile
2007-08-12 00:09:09: (response.c.446) -- logical -> physical
2007-08-12 00:09:09: (response.c.447) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.448) Rel-Path     : /nonexistingfile
2007-08-12 00:09:09: (response.c.449) Path         : /www/nonexistingfile
2007-08-12 00:09:09: (response.c.466) -- handling physical path
2007-08-12 00:09:09: (response.c.467) Path         : /www/nonexistingfile
2007-08-12 00:09:09: (response.c.523) -- file not found
2007-08-12 00:09:09: (response.c.524) Path         : /www/nonexistingfile
2007-08-12 00:09:09: (response.c.205) -- splitting Request-URI
2007-08-12 00:09:09: (response.c.206) Request-URI  :  /clear.gif
2007-08-12 00:09:09: (response.c.207) URI-scheme   :  http
2007-08-12 00:09:09: (response.c.208) URI-authority:  127.0.0.1
2007-08-12 00:09:09: (response.c.209) URI-path     :  /clear.gif
2007-08-12 00:09:09: (response.c.210) URI-query    :
2007-08-12 00:09:09: (response.c.260) -- sanatising URI
2007-08-12 00:09:09: (response.c.261) URI-path     :  /clear.gif
2007-08-12 00:09:09: (response.c.375) -- before doc_root
2007-08-12 00:09:09: (response.c.376) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.377) Rel-Path     : /clear.gif
2007-08-12 00:09:09: (response.c.378) Path         :
2007-08-12 00:09:09: (response.c.426) -- after doc_root
2007-08-12 00:09:09: (response.c.427) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.428) Rel-Path     : /clear.gif
2007-08-12 00:09:09: (response.c.429) Path         : /www/clear.gif
2007-08-12 00:09:09: (response.c.446) -- logical -> physical
2007-08-12 00:09:09: (response.c.447) Doc-Root     : /www
2007-08-12 00:09:09: (response.c.448) Rel-Path     : /clear.gif
2007-08-12 00:09:09: (response.c.449) Path         : /www/clear.gif
2007-08-12 00:09:09: (response.c.466) -- handling physical path
2007-08-12 00:09:09: (response.c.467) Path         : /www/clear.gif
2007-08-12 00:09:09: (response.c.474) -- file found
2007-08-12 00:09:09: (response.c.475) Path         : /www/clear.gif
2007-08-12 00:09:09: (response.c.613) -- handling subrequest
2007-08-12 00:09:09: (response.c.614) Path         : /www/clear.gif
2007-08-12 00:09:09: (mod_staticfile.c.394) -- handling file as static file
2007-08-12 00:09:09: (response.c.625) -- subrequest finished
2007-08-12 00:11:52: (server.c.1268) [note] graceful shutdown started
2007-08-12 00:11:52: (log.c.135) server stopped

-- autound

Actions #1

Updated by Anonymous over 17 years ago

Also to add, when the request is refreshed, the image data is not sent that time. Only on a new request.

So if I change the url to http://localhost/nofile it will show the image with the error appended, but only the error on a refresh. Now if I load http://localhost/nofile2 it will show the image with the error appended, but again with a refresh it will only show the 404 message.

-- autound

Actions #2

Updated by Anonymous over 17 years ago

Tested with 1.4.15 and the problem does not exist with that version.

-- autound

Actions #3

Updated by Anonymous over 17 years ago

Well after hours of debugging, I've found the problem.

The difference between 15 and 16 is a one line addition. Removing it has resolved the problem.


--- src/connections.c~  2007-08-12 01:50:48.000000000 +0100
+++ src/connections.c   2007-06-15 16:30:34.000000000 +0100
@@ -1445,7 +1445,6 @@
                                } else if (con->in_error_handler) {
                                        /* error-handler is back and has generated content */
                                        /* if Status: was set, take it otherwise use 200 */
-                                       con->http_status = con->error_handler_saved_status;
                                }

                                if (con->http_status == 0) con->http_status = 200;

I've tracked it down to changeset r1853

Actions #4

Updated by Anonymous over 17 years ago

This is a very serious bug. Amongst many other gotchas, it will break every rails installation using lighttpd unless they work around it with a cumbersome mod_magnet/lua solution (assuming they linked against lua at all), or just avoid upgrading lighttpd until it is fixed.

Actions #5

Updated by Anonymous over 17 years ago

Fixed in changeset 1899.

Actions #6

Updated by jan over 17 years ago

  • Status changed from New to Fixed
  • Resolution set to duplicate

This is a duplicate of #1270 and is fixed in r1899

Actions

Also available in: Atom