Fix possible RFC 1864 "Content-MD5" violation - trailing '='s.
authorshort <>
Sun, 18 Sep 2005 19:22:26 +0000 (19:22 +0000)
committershort <>
Sun, 18 Sep 2005 19:22:26 +0000 (19:22 +0000)
Web.pm

diff --git a/Web.pm b/Web.pm
index e4c5df0..e8c89c7 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -122,6 +122,7 @@ use Data::Dumper;
 require Encode;
 use Apache2::Filter;
 use Apache2::Connection;
+require MIME::Base64;
 
 
 #our $W;
@@ -988,7 +989,11 @@ sub cache_finish()
 
        # Prepare 'headers_out' for the future reusal:
        my %headers_out;
-       $headers_out{"Content-MD5"}=$W->{"digest-md5"}->b64digest();
+       # Do not: $W->{"digest-md5"}->b64digest();
+       # 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());
        # 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() ?