Bug 40628 - mod_isapi always returns status 500. Bug is in core (libhttpd)
mod_isapi always returns status 500. Bug is in core (libhttpd)
Status: RESOLVED DUPLICATE of bug 40067
Product: Apache httpd-2
Classification: Unclassified
Component: mod_isapi
2.2.2
Other Windows XP
: P2 normal (vote)
: ---
Assigned To: Apache HTTPD Bugs Mailing List
: ErrorMessage, PatchAvailable
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2006-09-28 10:09 UTC by Rick Betting
Modified: 2006-09-28 11:24 UTC (History)
0 users



Attachments
Corrected return value of funtion line 599 ap_scan_script_header_err_core (23.11 KB, text/plain)
2006-09-28 10:20 UTC, Rick Betting
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Betting 2006-09-28 10:09:58 UTC
Every ISAPI returns status 500 "internal server error" and it returns the 
desired content. No real error has occurred.

I could trace it back to: (Source taken from httpd-2.2.3 win32 version)

mod_apache.c line 713: function apr_ssize_t send_response_header

Cid->r->status = ap_scan_script_header_err_strs(cid->r, NULL,
                                   &termch, &termarg, stat, head, NULL);
cid->ecb->dwHttpStatusCode = cid->r->status;

Termarg = 2
Stat = "Status: 200 OK"
Head	= "Content-Type: text/html\r\nContent-Length: 22\r\n\r\n"

Retun value is 0. Should be 200.



util_script.c line 714: function ap_scan_script_header_err_strs

res = ap_scan_script_header_err_core(r, buffer, getsfunc_STRING, 
                                                           (void *) &strs);

Return value is 0. Should be 200.



After successfull execution of function ap_scan_script_header_err_core
util_script.c line 599: function ap_scan_script_header_err_core

return OK;


OK is defined in httpd.h
httpd.h line 445:

#define OK 0			/**< Module has handled this stage. */

HTTP_OK is defined in httpd.h
httpd.h line 462:

#define HTTP_OK                            200


Solution:
The return OK; in util_script.c line 599 should be replaced with return HTTP_OK;
The other possible return in ap_scan_script_header_err_core is 
HTTP_INTERNAL_SERVER_ERROR which is the value 500. (that shows HTTP_ results 
are required in the function.)

Because the return value is 0 mod_apache reads the client content. Later return 
value 0 is recognized as invalid and it reports an internal server error.
Comment 1 Rick Betting 2006-09-28 10:20:16 UTC
Created attachment 18929 [details]
Corrected return value of funtion line 599 ap_scan_script_header_err_core

Corrected return value of funtion line 599 ap_scan_script_header_err_core
Original value was OK new value is HTTP_OK
This solves the ISAPI bug.
Comment 2 Nick Kew 2006-09-28 10:47:00 UTC
That's not a patch.  It's plain source code, and not in a form suitable for 
review.

In any case, you can't just go breaking util_script, which is required by 
*everything* in the CGI family, not just mod_isapi.  There *may* be a bug in 
mod_isapi, but you should check the latest fixes to that, particularly
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/arch/win32/mod_isapi.c?r1=414238&r2=416272
Comment 3 Rick Betting 2006-09-28 12:06:57 UTC
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/arch/win32/mod_isapi.c?
r1=414238&r2=416272
Is indeed the solution.
Thank you.
Comment 4 William A. Rowe Jr. 2006-09-28 17:48:21 UTC
Also don't go changing AssignedTo *EVER*.  You broke the linkage for all the
feedback to come to the bugs list.
Comment 5 William A. Rowe Jr. 2006-09-28 18:24:44 UTC

*** This bug has been marked as a duplicate of 40067 ***