Subject: | Escape status line in error_as_HTML, convert to lowercase |
The attached patch makes sure that the return value of status_line()
will be HTML escaped, and converts the code to lowercase and adds
missing <p> in order to make it valid XHTML strict.
Subject: | htmlerror.patch |
Index: lib/HTTP/Response.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/HTTP/Response.pm,v
retrieving revision 1.53
diff -u -r1.53 Response.pm
--- lib/HTTP/Response.pm 6 Dec 2005 13:19:09 -0000 1.53
+++ lib/HTTP/Response.pm 10 Feb 2008 21:50:37 -0000
@@ -121,17 +121,18 @@
sub error_as_HTML
{
+ require HTML::Entities;
my $self = shift;
my $title = 'An Error Occurred';
- my $body = $self->status_line;
+ my $body = HTML::Entities::encode($self->status_line);
return <<EOM;
-<HTML>
-<HEAD><TITLE>$title</TITLE></HEAD>
-<BODY>
-<H1>$title</H1>
-$body
-</BODY>
-</HTML>
+<html>
+<head><title>$title</title></head>
+<body>
+<h1>$title</h1>
+<p>$body</p>
+</body>
+</html>
EOM
}