How to debug httpd?
Pierre Métras
genepi at sympatico.ca
Thu Aug 16 07:01:52 PDT 2007
Hi,
I've found a strange behavior in httpd, from current SVN version, but I don't
know how to debug it.
When you run httpd with the new verbose -v option, it shows you the headers
sent back to the client. From time to time, and probably depending on the
browser used, httpd sends an extra 404 response.
For instance, in the following session example, I requested an existing page
which was successfully displayed in FireFox (HTTPD status 200 OK + extra
404), and then requested to view the content of httpd.conf (HTTPD status 403
forbidden + extra 404). Then I requested again the existing page twice and
got two 404 instead of 200!
$ ./busybox httpd -v -f -c httpd.conf -p 9090
127.0.0.1:39080 response:200 <-- test.html
127.0.0.1:39081 response:404
127.0.0.1:39089 response:403 <-- httpd.conf
127.0.0.1:39090 response:404
127.0.0.1:39091 response:404 <-- test.html
127.0.0.1:39092 response:404 <-- test.html
If I trace the browser-server dialog with telnet, everything is fine:
$ telnet localhost 9090
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /test.html HTTP/1.0
HTTP/1.0 200 OK
Content-type: text/html
Date: Thu, 16 Aug 2007 13:53:49 GMT
Connection: close
Last-Modified: Thu, 16 Aug 2007 11:45:13 GMT
Content-length: 83
<html><head><title>TEST</title></head>
<body><h1>Ça fonctionne!</h1></body></html>
Connection closed by foreign host.
It looks like an extra child process is created which generates the 404.
As I'm not a gdb guru, I can find a way to put a breakpoint on the
sendHeaders() function and explore the context of the call: I set the
breakpoint but the thread of execution doesn't stop on it.
Could someone explain me how to debug this or correct this bug before I upload
my patch for custom error pages?
Thanks
-- Pierre Métras
More information about the busybox
mailing list