You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2002/08/29 16:42:43 UTC

DO NOT REPLY [Bug 12162] New: - Every correct ISAPI call returns error message

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12162>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12162

Every correct ISAPI call returns error message

           Summary: Every correct ISAPI call returns error message
           Product: Apache httpd-2.0
           Version: 2.0.40
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: mod_isapi
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: aklimuk@iba.by


When ISAPI extension result code is 200 (OK), Apache correctly sends to client 
all content generated by ISAPI extension, but Apache always appends this 
content by error message (about internal server error).

E.g. ISAPI extension generates following response:
=========
<html><body>Hello</body></html>
=========

Then Apache actually sends to client following:
=========
<html><body>Hello</body></html><!DOCTYPE ...>
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
...
=========

This occurs for any ISAPI extension module. The same extensions work fine under 
Apache 1.3.12, 1.3.23, 2.0.32b.

I made an investigation and found the cause of this bug.
Briefly, problem occurs because "isapi_handler()" function returns HTTP status 
code instead of OK.
See details below.

ISAPI handler is called from "ap_invoke_handler()" function (config.c module, 
line 400):
    result = ap_run_handler(r);
"ap_invoke_handler" is called from "ap_process_request()" function 
(http_request.c module, line 257):
    access_status = ap_invoke_handler(r);
Function "ap_process_request()" expects that value of "access_status" is one of 
following: OK (0), DECLINED (-1), or DONE (-2).
But actually "access_status" has value 200, therefore "ap_die" is called 
(http_request.c module, line 270), and error is reported. Furthermore, error 
message is appended to normal content, generated by ISAPI extension.
"access_status" has value 200 because "ap_invoke_handler()" returns it. And 
this occurs because "isapi_handler()" (mod_isapi.c module) returns 200.
See line 1537 in mod_isapi.c:
    return cid->r->status;
We should replace it by following one:
    return OK;
Then problem disappears.
Compare this string to one from 2.0.32b:
    return OK;		/* NOT r->status, even if it has changed. */

This is a fix for "normal" response from ISAPI extension when it returns 200. 
All other "return" entries in "isapi_handler()" function seem to be correct.


Best regards,
Alexander Klimuk




isapi_handler function returns HTTP status code instead of OK

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org