Subject: | [PATCH] encode_base64() without empty string as line-ending sequence causes Bad Request |
Quote from the patch commit message:
Bugfix: pass empty string as line-ending sequence in encode_base64()
Otherwise, encode_base64() appends "\n" which in turn produces an HTTP
request
that looks like this:
GET / HTTP/1.0\r\n
Host: foo.bar\r\n
Authorization: foobar==\n
\r\n
\r\n
Such a request confuses lighttpd and causes it to spit out 400 Bad request
instead of the actual content.
Subject: | 0001-Bugfix-pass-empty-string-as-line-ending-sequence-in-.patch |
From 7a02abfe2422af0b80a5888e6aa47dc98d7c6787 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Fri, 24 Dec 2010 18:19:05 +0100
Subject: [PATCH] Bugfix: pass empty string as line-ending sequence in encode_base64()
Otherwise, encode_base64() appends "\n" which in turn produces an HTTP request
that looks like this:
GET / HTTP/1.0\r\n
Host: foo.bar\r\n
Authorization: foobar==\n
\r\n
\r\n
Such a request confuses lighttpd and causes it to spit out 400 Bad request
instead of the actual content.
---
lib/AnyEvent/Feed.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/AnyEvent/Feed.pm b/lib/AnyEvent/Feed.pm
index 5a765b0..bd51e6e 100644
--- a/lib/AnyEvent/Feed.pm
+++ b/lib/AnyEvent/Feed.pm
@@ -259,7 +259,7 @@ sub _get_headers {
}
$hdrs{Authorization} =
- "Basic " . encode_base64 (join ':', $self->{username}, $self->{password})
+ "Basic " . encode_base64 (join(':', $self->{username}, $self->{password}), '')
if defined $self->{username};
\%hdrs
--
1.7.1