Subject: | Redirect Message not W3C valid |
Hi!
When testing all our output for valid HTML we stumbled upon the redirect
<body> being absolutely not valid.
I changed it to this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Moved</title>
</head>
<body>
<p>This item has moved <a
href="http://localhost:3000/go/Homepage/1073/Gesundheit.html">here</a>.</p>
</body>
</html>
I would like to attach this patch. All tests still successful ;)
works for us and our browsers (firefox, chromium, w3m, links, lynx)
all the best,
koki
Subject: | valid_redirect_response_body.patch |
diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm
index 2d828b1..ef418ab 100644
--- a/lib/Catalyst.pm
+++ b/lib/Catalyst.pm
@@ -1863,9 +1863,17 @@ sub finalize_headers {
if ( !$response->has_body ) {
# Add a default body if none is already present
- $response->body(
- qq{<html><body><p>This item has moved <a href="$location">here</a>.</p></body></html>}
- );
+ $response->body(<<"EOF");
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Moved</title>
+ </head>
+ <body>
+ <p>This item has moved <a href="$location">here</a>.</p>
+ </body>
+</html>
+EOF
$response->content_type('text/html; charset=utf-8');
}
}