Skip Menu |
 

This queue is for tickets about the Net-OAuth-Simple CPAN distribution.

Report information
The Basics
Id: 46424
Status: resolved
Priority: 0/
Queue: Net-OAuth-Simple

People
Owner: Nobody in particular
Requestors: chris [...] oak-wood.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.1
Fixed in: (no value)



Subject: Authorisation fails when posting 'wide' characters
Download (untitled) / with headers
text/plain 856b
I have reported a bug in Net::Twitter::OAuth at http://rt.cpan.org/Public/Bug/Display.html?id=46423 This appears to be a problem with Net::OAuth::Simple. When posting fields with 'wide' characters in to Twitter, Twitter returns "Failed to validate oauth signature or token". Net::OAuth::Simple throws an exception: post on http://twitter.com/statuses/update.json?oauth_timestamp=1243456768&oauth_consumer_key=QZ2pIVQF2G6JllVkOFTPw&status=Another+test+status+4+%C3%A9%C2%A6%C2%96%C3%A9%C2%83%C2%BD%C3%A5%C2%9C%C2%8F&oauth_signature=QYLE3Zzml2ZYY77wMPgAHcBXM1w%3D&oauth_nonce=2610890340&oauth_token=42584122-14QBiEvv7kY0C1UYBAj3hW9sKXyAFEJGlXr3u66ib&oauth_version=1.0&oauth_signature_method=HMAC-SHA1 failed: 401 Unauthorized at /usr/local/lib/perl5/site_perl/5.8.8/Net/OAuth/Simple.pm line 567 Perl v5.8.8 built for amd64-freebsd Net::OAuth::Simple 1.1
Download (untitled) / with headers
text/plain 1.5k
This seems to be solved by patching Net/OAuth/Message.pm as follows: --- Message.pm.orig Thu May 28 20:27:21 2009 +++ Message.pm Thu May 28 20:27:32 2009 @@ -86,7 +86,7 @@ sub encode { my $str = shift; $str = "" unless defined $str; - return URI::Escape::uri_escape_utf8($str,'^\w.~-'); + return URI::Escape::uri_escape($str,'^\w.~-'); } sub decode { I'm using Net::Twitter::OAuth. With this patch applied I need to use encode('UTF-8', $status) on my string first. Using a $status formed by $status = HTML::Entities::decode("A test status 6 기러기"); Watching the value of $request_url being hit in Net::OAuth::Simple::_make_request, and the value of $request->signature_base_string as I try various things gives (only the relevant parts here): Works: patched, encoded status=A+test+status+6+%EA%B8%B0%EB%9F%AC%EA%B8%B0 %26status%3DA%2520test%2520status%25206%2520%25EA%25B8%25B0%25EB%259F%25AC%25EA%25B8%25B0 Unpatched, unencoded &status=A+test+status+6+ %26status%3DA%2520test%2520status%25206%2520%25EA%25B8%25B0%25EB%259F%25AC%25EA%25B8%25B0 Unpatched, encoded &status=A+test+status+6+%EA%B8%B0%EB%9F%AC%EA%B8%B0 %26status%3DA%2520test%2520status%25206%2520%25C3%25AA%25C2%25B8%25C2%25B0%25C3%25AB%25C2%259F%25C2%25AC%25C3%25AA%25C2%25B8%25C2%25B0 You'll see that compared to what eventually worked, on an unpatched code I get the right signature_base_string if I don't encode, but the request_url has the wide characters stripped. To get the request URL right I have to encode, but that does something odd to signature_base_string.
Released 1.5 which requires the latest version of Net::OAuth which should fix this. Thanks! Simon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.