Red Hat Bugzilla – Bug 107982
handler's behavior is strange when handler returns error
Last modified: 2007-04-18 12:58:46 EDT
Description of problem:
Return error in a handler, but go to next hander instead of go to logging phase.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Install httpd-2.0.40-21.5.i386.rpm and httpd-devel-2.0.40-21.5.i386.rpm
2. Generate a module by `apxs -g -n overrun' command, and write
mod_overrun.c. Please see link of URL section.
3. Install this module and add follwings to httpd.conf:
LoadModule overrun_module modules/mod_overrun.so
4. Access to `http://hostname/somewhere/.'
The `OK' message and the `NG' message appears in the error log
which wirtten by overrun_access_checker.
The `NG' message is not appears in the error log.
Only the `OK' message is appears.
I compiled httpd-2.0.47 manually `./configure; make; make install' and
tryed same module, but above problem was not appeared.
/usr/sbin/httpd in httpd-2.0.40-21.5.i386.rpm is borken?
Created attachment 95502 [details]
I moved to sample code sample code to `Attachment' and updated it.
I'm sorry to I didn't attach and comment at same time.
I set some value to request_rec->notes in the first handler and return error,
control is moved to next handler (this is bug) and if code accesses to
request_rec->notes then value will lost.
If code accesses to the value without check for NULL (it is negligence but)
then Segmentation fault will occurs.
Created attachment 95939 [details]
Patch for re-creation
I checked the source code of httpd-2.0.40 and found
the place of problem in server/request.c.
I think that the httpd have to return from `ap_process_request_internal'
when `ap_run_translate_name' returns 404(it is a return code from module)
But httpd goes through next steatment for unknown reason.
I could not trace the Apache source code moreover.
Please try attached patch(it is not for solving the problem.
it is for re-creation.) and previous attached module at once.
I can't reproduce a problem here. The translate_name hook is run,
writes the log entry, and returns HTTP_NOT_FOUND, and that is what is
sent to the client.
The access_check hook is never run, as expected.
I tryed to update glibc and kernel, but problem was not solved.
Then I installed Red Hat 9 other machine and try the
first module, but the problem appeared again.
My environment is:
OS Red Hat 9
Please let me know the difference between above and
the environment that the problem not happened.
The reason of this problem is a setting in httpd.conf.
Error document is set in httpd.conf from httpd-2.0.40-21.5.rpm.
When a handler returns a HTTP error then httpd request to the error
document file again. This second request cause this problem.
I skipped this problem by follwoing procedure:
- ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
+ # ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
Sorry. It's not rpm's problem.