Hello everyone, I'm wondering whether the following is intended behavior. Calling die inside the mod_perl handler doesn't clear the part of the response generated to that point. In other words, the HTML error document is simply appended to anything that has been sent to $r->print() previously and the whole thing arrives as a 200 Response.
I initially thought that the problem was that the first part of the response is sent before the call to die(). However, after adding the sleep statement, I see nothing in the browser for 30 seconds. ## Here's the code for the handler: package test1; use strict; use warnings; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK); sub handler { my $r = shift; $r->content_type('text/plain'); $r->print("Hello World! \$| is $|."); sleep(30); die('just testing'); return Apache2::Const::OK; # or SERVER_ERROR - makes no difference after die } 1; ## Here's the response I get back (after 30 secs of nothing): [EMAIL PROTECTED] ~]$ lynx 'http://localhost/test1' Hello World! $| is 0.<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <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> <p>Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p> <p>More information about this error may be available in the server error log.</p> </body></html> ## And the header, just fyi (also shows version numbers): [EMAIL PROTECTED] ~]$ lynx -head 'http://localhost/test1' HTTP/1.1 200 OK Date: Sat, 30 Jun 2007 01:43:45 GMT Server: Apache/2.2.4 (Fedora) DAV/2 PHP/5.2.2 mod_python/3.3.1 Python/2.5 mod_s sl/2.2.4 OpenSSL/0.9.8b mod_apreq2-20051231/2.6.1 mod_perl/2.0.3 Perl/v5.8.8 Connection: close Content-Type: text/plain; charset=UTF-8 ## And a small part from my httpd.conf <Location /test1> SetHandler modperl PerlResponseHandler test1 </Location> So, is this intended behavior? I know that it can be fixed by storing everything in a scalar and only having one print statement at the end, but it seems odd that I don't recall reading anything about this in any of the documentation. Thank you for reading this.