Manage UTF-8 values in HTTP headers
Since 1.9, seems we have an issue with UTF-8 values in HTTP Headers:
As written by @guimard :
From rfc7230#section-3.2.4:
Historically, HTTP has allowed field content with text in the ISO-8859-1 charset [ISO-8859-1], supporting other charsets only through use of [RFC2047] encoding. In practice, most HTTP header field values use only a subset of the US-ASCII charset [USASCII]. Newly defined header fields SHOULD limit their field values to US-ASCII octets. A recipient SHOULD treat other octets in field content (obs-text) as opaque data.
so "downgrade" is required if you want to take the risk to send some non-ascii characters.
Note that LLNG-1.4 wasn't really UTF8, that's why it has accidentally succeed to send encoded headers.
Here is the proposed patch:
diff --git
a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
index 1a0193e1b..2695c85b0 100644
--- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
+++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/API/ApacheMP2.pm
@@ -99,6 +99,8 @@ sub header_in {
sub set_header_in {
my ( $class, %headers ) = @_;
while ( my ( $h, $v ) = each %headers ) {
+ use utf8;
+ utf8::downgrade($v);
$request->headers_in->set( $h => $v );
}
}