r47375 - in /branches/upstream/libnet-oauth-perl/current: Build.PL Changes META.yml Makefile.PL lib/Net/OAuth.pm lib/Net/OAuth/Message.pm lib/Net/OAuth/Request.pm t/09-encoding.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Nov 17 16:42:47 UTC 2009


Author: jawnsy-guest
Date: Tue Nov 17 16:42:38 2009
New Revision: 47375

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=47375
Log:
[svn-upgrade] Integrating new upstream version, libnet-oauth-perl (0.20)

Modified:
    branches/upstream/libnet-oauth-perl/current/Build.PL
    branches/upstream/libnet-oauth-perl/current/Changes
    branches/upstream/libnet-oauth-perl/current/META.yml
    branches/upstream/libnet-oauth-perl/current/Makefile.PL
    branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth.pm
    branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Message.pm
    branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Request.pm
    branches/upstream/libnet-oauth-perl/current/t/09-encoding.t

Modified: branches/upstream/libnet-oauth-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/Build.PL?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/Build.PL (original)
+++ branches/upstream/libnet-oauth-perl/current/Build.PL Tue Nov 17 16:42:38 2009
@@ -17,6 +17,8 @@
         'URI::Escape' => '3.28',
         'Class::Accessor' => '0.31',
         'Class::Data::Inheritable' => '0.06',
+        'Digest::SHA1' => '2.12',
+        'Encode' => '2.35',
     },
     add_to_cleanup      => [ 'Net-OAuth-*' ],
     create_makefile_pl => 'passthrough',

Modified: branches/upstream/libnet-oauth-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/Changes?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/Changes (original)
+++ branches/upstream/libnet-oauth-perl/current/Changes Tue Nov 17 16:42:38 2009
@@ -66,8 +66,15 @@
   Fixed https://rt.cpan.org/Public/Bug/Display.html?id=47293 - Message->from_hash was validating using the incorrect class, causing a 'Parameter X not valid for a message of type Y' message on V1.0a messages.  Thanks Jeff Dairiki!
 
 0.18   Thu, 25 Jun 2009 17:18:04 UTC
-    Fixed accidental (though probably harmless) regression in 0.17
+  Fixed accidental (though probably harmless) regression in 0.17
 
 0.19   Fri, 26 Jun 2009 17:30:06 UTC
-    Fixed https://rt.cpan.org/Ticket/Display.html?id=47369 - Don't automatically set oauth_version parameter when message is created via from_hash (or from_url, from_post_body, etc).  Thanks COSIMO!
+  Fixed https://rt.cpan.org/Ticket/Display.html?id=47369 - Don't automatically set oauth_version parameter when message is created via from_hash (or from_url, from_post_body, etc).  Thanks COSIMO!
+
+0.20   Fri, 13 Nov 2009 18:56:55 UTC
+  Fixed http://rt.cpan.org/Public/Bug/Display.html?id=48867 - error in synopsis - thanks Adam Taylor!
+  Removed UTF8 double-encoding warning.  Now Net::OAuth::Message::encode() uses Encode::is_utf8() to determine if the input is already UTF-8 encoded.  If so, it runs decode_utf8() on it before sending it to uri_escape_utf8().  Thanks Hector Garcia Alvarez!
+  Potentially fixed an issue found by Marc Mims, where HMAC_SHA1 was failing to load, breaking some CPAN tests.  Build.PL now explicitly requires Digest::SHA1 and Encode.  Hopefully that fixes it.
+  
+        
     

Modified: branches/upstream/libnet-oauth-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/META.yml?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/META.yml (original)
+++ branches/upstream/libnet-oauth-perl/current/META.yml Tue Nov 17 16:42:38 2009
@@ -1,6 +1,6 @@
 ---
 name: Net-OAuth
-version: 0.19
+version: 0.20
 author:
   - 'Keith Grennan <kgrennan at cpan.org>'
 abstract: An implementation of the OAuth protocol
@@ -11,13 +11,17 @@
   Class::Accessor: 0.31
   Class::Data::Inheritable: 0.06
   Digest::HMAC_SHA1: 1.01
+  Digest::SHA1: 2.12
+  Encode: 2.35
   Test::More: 0.66
   UNIVERSAL::require: 0.10
   URI::Escape: 3.28
+configure_requires:
+  Module::Build: 0.35
 provides:
   Net::OAuth:
     file: lib/Net/OAuth.pm
-    version: 0.19
+    version: 0.20
   Net::OAuth::AccessTokenRequest:
     file: lib/Net/OAuth/AccessTokenRequest.pm
   Net::OAuth::AccessTokenResponse:
@@ -30,7 +34,7 @@
     file: lib/Net/OAuth/ProtectedResourceRequest.pm
   Net::OAuth::Request:
     file: lib/Net/OAuth/Request.pm
-    version: 0.19
+    version: 0.20
   Net::OAuth::RequestTokenRequest:
     file: lib/Net/OAuth/RequestTokenRequest.pm
   Net::OAuth::RequestTokenResponse:
@@ -55,7 +59,7 @@
     file: lib/Net/OAuth/V1_0A/RequestTokenResponse.pm
   Net::OAuth::V1_0A::UserAuthResponse:
     file: lib/Net/OAuth/V1_0A/UserAuthResponse.pm
-generated_by: Module::Build version 0.2808
+generated_by: Module::Build version 0.35
 meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Modified: branches/upstream/libnet-oauth-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/Makefile.PL?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/Makefile.PL (original)
+++ branches/upstream/libnet-oauth-perl/current/Makefile.PL Tue Nov 17 16:42:38 2009
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.03
+# Note: this file was auto-generated by Module::Build::Compat version 0.35
     
     unless (eval "use Module::Build::Compat 0.02; 1" ) {
       print "This module requires Module::Build to install itself.\n";
@@ -27,5 +27,8 @@
     eval "use Module::Build::Compat 0.02; 1" or die $@;
     
     Module::Build::Compat->run_build_pl(args => \@ARGV);
+    my $build_script = 'Build';  
+    $build_script .= '.com' if $^O eq 'VMS';
+    exit(0) unless(-e $build_script); # cpantesters convention
     require Module::Build;
     Module::Build::Compat->write_makefile(build_class => 'Module::Build');

Modified: branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth.pm?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth.pm (original)
+++ branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth.pm Tue Nov 17 16:42:38 2009
@@ -8,8 +8,8 @@
 
 sub OAUTH_VERSION() {'1.0'}
 
-our $VERSION = '0.19';
-our $SKIP_UTF8_DOUBLE_ENCODE_CHECK = 0;
+our $VERSION = '0.20';
+our $SKIP_UTF8_DOUBLE_ENCODE_CHECK = 0; # this is not actually used any more
 our $PROTOCOL_VERSION = PROTOCOL_VERSION_1_0;
 
 sub request {
@@ -94,7 +94,7 @@
     use CGI;
     my $q = new CGI;
 
-    my $request = Net::OAuth->request("request token")->from_hash($q->Vars,
+    my $request = Net::OAuth->request("request token")->from_hash({$q->Vars},
         request_url => 'https://photos.example.net/request_token',
         request_method => $q->request_method,
         consumer_secret => 'kd94hf93k423kf44',
@@ -203,9 +203,9 @@
 
 You can also create a message by deserializing it from a Authorization header, URL, query hash, or POST body
 
- $request = Net::OAuth->request('protected resource')->from_authorization_header($header, %api_params);
+ $request = Net::OAuth->request('protected resource')->from_authorization_header($ENV{HTTP_AUTHORIZATION}, %api_params);
  $request = Net::OAuth->request('protected resource')->from_url($url, %api_params);
- $request = Net::OAuth->request('protected resource')->from_hash($q->Vars, %api_params); # CGI
+ $request = Net::OAuth->request('protected resource')->from_hash({$q->Vars}, %api_params); # CGI
  $request = Net::OAuth->request('protected resource')->from_hash($c->request->params, %api_params); # Catalyst
  $response = Net::OAuth->response('request token')->from_post_body($response_content, %api_params);
 
@@ -363,24 +363,7 @@
 
 =head2 I18N
 
-Per the OAuth spec, when making the signature Net::OAuth first encodes parameters to UTF-8. This means that any parameters you pass to Net::OAuth, if they are outside of ASCII character set, should be run through Encode::decode() (or an equivalent PerlIO layer) first to decode them to Perl's internal character sructure.
-
-There is a check in Net::OAuth's parameter encoding function that guesses if the data you are passing in looks like it is already UTF-8 and warns that you should decode it first. This accidental double-encoding of UTF-8 may be a source of headaches - if you find that the signature check is failing when you send non-ASCII data, that is a likely cause. 
-
-You can silence this warning by setting:
-
-    $Net::OAuth::SKIP_UTF8_DOUBLE_ENCODE_CHECK = 1;
-
-Following is an example of decoding some UTF-8 form data before sending it in an OAuth messaage (from the Twitter demo included in the Net::OAuth package):
-
-    my $request = Net::OAuth->request("protected resource")->new(
-        $self->_default_request_params,
-        request_url => 'http://twitter.com/statuses/update.xml',
-        token => $self->session->param('token'),
-        token_secret => $self->session->param('token_secret'),
-        request_method => 'POST',
-        extra_params => {status => decode_utf8($self->query->param('status'))}
-    );
+Per the OAuth spec, when making the signature Net::OAuth first encodes parameters to UTF-8. This means that any parameters you pass to Net::OAuth, if they might be outside of ASCII character set, should be run through Encode::decode() (or an equivalent PerlIO layer) first to decode them to Perl's internal character sructure.
 
 =head2 OAUTH 1.0A
 
@@ -439,6 +422,34 @@
 
 Check out L<WWW::Netflix::API> for a Netflix-specific OAuth API
 
+=head1 TODO
+
+=over
+
+=item * Support for repeating/multivalued parameters
+
+=item * Add convenience methods for SPs
+
+Something like:
+    
+    # direct from CGI.pm object
+    $request = Net::OAuth->request('Request Token')->from_cgi_query($cgi, %api_params);
+    
+    # direct from Catalyst::Request object
+    $request = Net::OAuth->request('Request Token')->from_catalyst_request($c->req, %api_params); 
+    
+    # from Auth header and GET and POST params in one
+    local $/;
+    my $post_body = <STDIN>;
+    $request = Net::OAuth->request('Request Token')->from_auth_get_and_post(
+        $ENV{HTTP_AUTHORIZATION}, 
+        $ENV{QUERY_STRING},
+        $post_body,
+        %api_params
+    );
+
+=back
+
 =head1 AUTHOR
 
 Keith Grennan, C<< <kgrennan at cpan.org> >>

Modified: branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Message.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Message.pm?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Message.pm (original)
+++ branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Message.pm Tue Nov 17 16:42:38 2009
@@ -103,16 +103,14 @@
 sub encode {
     my $str = shift;
     $str = "" unless defined $str;
-    unless($Net::OAuth::SKIP_UTF8_DOUBLE_ENCODE_CHECK) {
-        if ($str =~ /[\x80-\xFF]/) {
-            Encode->require;
-            no strict 'subs';
-            eval {
-                Encode::decode_utf8($str, 1);
-            };
-            unless ($@) {
-                warn "Warning: It looks like you are attempting to encode bytes that are already UTF-8 encoded.  You should probably use decode_utf8() first.  See the Net::OAuth manpage, I18N section";
-            }
+    if ($str =~ /[\x80-\xFF]/) {
+        Encode->require;
+        no strict 'subs';
+        if (Encode::is_utf8($str)) {
+            # Avoid double-encoding UTF-8.
+            # Ideally the caller would have done this already
+            # But perl5 + unicode is very confusing, so try to be helpful..
+            $str = Encode::decode_utf8($str, 1);
         }
     }
     return URI::Escape::uri_escape_utf8($str,'^\w.~-');

Modified: branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Request.pm?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Request.pm (original)
+++ branches/upstream/libnet-oauth-perl/current/lib/Net/OAuth/Request.pm Tue Nov 17 16:42:38 2009
@@ -5,7 +5,7 @@
 use URI;
 use URI::QueryParam;
 
-our $VERSION = '0.19';
+our $VERSION = '0.20';
 
 __PACKAGE__->mk_classdata(required_message_params => [qw/
     consumer_key
@@ -72,6 +72,7 @@
     my $self = shift;
     my $url = $self->request_url;
     Net::OAuth::Message::_ensure_uri_object($url);
+    $url = $url->clone;
     $url->query(undef);
     return $url;
 }

Modified: branches/upstream/libnet-oauth-perl/current/t/09-encoding.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-oauth-perl/current/t/09-encoding.t?rev=47375&op=diff
==============================================================================
--- branches/upstream/libnet-oauth-perl/current/t/09-encoding.t (original)
+++ branches/upstream/libnet-oauth-perl/current/t/09-encoding.t Tue Nov 17 16:42:38 2009
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 22;
+use Test::More tests => 18;
 use Encode;
 
 BEGIN {
@@ -35,11 +35,3 @@
 is_encoding("ç", '%C3%A7');
 is_encoding("æ", '%C3%A6');
 
-my $warning = '';
-$SIG{__WARN__} = sub {$warning = shift};
-is_encoding(Encode::encode_utf8("\x{00E7}"), '%C3%83%C2%A7');
-ok($warning =~ /^Warning: It looks like you are attempting to encode bytes that are already UTF-8 encoded/);
-$warning = '';
-$Net::OAuth::SKIP_UTF8_DOUBLE_ENCODE_CHECK = 1;
-is_encoding(Encode::encode_utf8("\x{00E7}"), '%C3%83%C2%A7');
-is($warning, '');




More information about the Pkg-perl-cvs-commits mailing list