Workarounded MIME::Base64 for 'Content-MD5' header.
authorshort <>
Sun, 18 Sep 2005 19:29:52 +0000 (19:29 +0000)
committershort <>
Sun, 18 Sep 2005 19:29:52 +0000 (19:29 +0000)
No longer warn on utf-8 &puts to Apache, it is just valid.

Web.pm

diff --git a/Web.pm b/Web.pm
index e8c89c7..07db01c 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -296,7 +296,8 @@ my($text,%args)=@_;
        delete $args{"undef"};
        cluck join(" ","Invalid arguments:",keys(%args)) if keys(%args);
        return if !defined $text;
-       cluck "utf-8 untested" if Encode::is_utf8($text);
+       # Do not: cluck "utf-8 untested" if Encode::is_utf8($text);
+       # as it is valid here.
        $W->{"r"}->puts($text);
 }
 
@@ -993,7 +994,8 @@ sub cache_finish()
        # as it will not provide the trailing filling '='s.
        # RFC 1864 is not clear but the same provides them.
        # FIXME: Should we somehow provide "\r\n" newlines for the text data? Which content is "text"?
-       $headers_out{"Content-MD5"}=MIME::Base64::encode_base64($W->{"digest-md5"}->digest());
+       # ',""' to avoid breaking the headers by its default "\n".
+       $headers_out{"Content-MD5"}=MIME::Base64::encode_base64($W->{"digest-md5"}->digest(),"");
        # In fact we could also use MD5 for ETag as if we know ETag we also know MD5.
        # But this way we do not need to calculate MD5 and we still can provide such ETag. So.
        # $W->{"r"}->set_etag() ?