Subject: | Verification fail when in some fields contain unicode characters |
Date: | Mon, 7 Sep 2015 15:15:48 +0200 |
To: | <bug-Net-OpenID-Consumer [...] rt.cpan.org> |
From: | Ondrej Holecek <oholecek [...] suse.com> |
Hi,
when some fields returned by openid server contain unicode characters
subsequent HTTP verification fail (server returns is_valid: false). But when
"charset=UTF-8" is added to request, verification succeed.
Thanks,
OH
Module: perl-Net-OpenID-Consumer-1.16-2.1.noarch
Distri: openSUSE Tumbleweed (20150903)
Perl: v5.22.0
Example diff of my solution:
diff --git a/lib/Net/OpenID/Consumer.pm b/lib/Net/OpenID/Consumer.pm
index a2261cb..9a9953b 100644
--- a/lib/Net/OpenID/Consumer.pm
+++ b/lib/Net/OpenID/Consumer.pm
@@ -976,7 +976,7 @@ sub verified_identity {
$post{"openid.mode"} = "check_authentication";
my $req = HTTP::Request->new(POST => $server);
- $req->header("Content-Type" => "application/x-www-form-urlencoded");
+ $req->header("Content-Type" => "application/x-www-form-urlencoded;
charset=UTF-8");
$req->content(join("&", map { "$_=" . uri_escape_utf8($post{$_}) }
keys %post));
my $ua = $self->ua;
Message body not shown because it is not plain text.