I'm trying to generate a HTTP response containing a HTTP error code, but
also containing a body with an explanation of the error.
The normal case first:
$m->clear_buffer;
$r->content_type ('text/plain');
print "foobar\n";
$m->abort (200);
$ GET -s http://localhost/tmp/errortest.mhtml
200 OK
foobar
No surprises there, but if I try to change the status code:
$m->clear_buffer;
$r->content_type ('text/plain');
print "foobar\n";
$m->abort (400);
~$ GET -s http://localhost/tmp/errortest.mhtml
200 OK
foobar
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>200 OK</title>
</head><body>
<h1>OK</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.16 Server at localhost Port 80</address>
Note that the HTTP status is 200, while the body indicates some error
condition. Both my body content and my status code has been altered!
If the page has no body, at least the status code is correctly preserved:
$m->clear_buffer;
$r->content_type ('text/plain');
$m->abort (400);
$ GET -s http://localhost/tmp/errortest.mhtml
400 Bad Request
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.16 Server at localhost Port 80</address>
</body></html>
So, I am obviously confused about the interaction between Mason,
mod_perl and apache when generating responses containing body and HTTP
errors. Can anybody enlighten me.
- Vegard V -
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users