You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/04/01 13:56:33 UTC

svn commit: r1087662 - /couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl

Author: fdmanana
Date: Fri Apr  1 11:56:33 2011
New Revision: 1087662

URL: http://svn.apache.org/viewvc?rev=1087662&view=rev
Log:
Fix OAuth signature computation in OTP R14B02

In OTP versions prior to R14B02, the OAuth signature was correctly calculated
due to a bug in the OTP stdlib. This was fixed in R14B02 (OTP-8989, check
http://erlang.org/download/otp_src_R14B02.readme).

Before R14B02:

    Erlang R14B01 (erts-5.8.2) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

    Eshell V5.8.2  (abort with ^G)
    1> lists:flatten(io_lib:format("%~2.1.0s", [erlang:integer_to_list($+, 16)])).
    "%2B"

In R14B02:

    Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

    Eshell V5.8.3  (abort with ^G)
    1> lists:flatten(io_lib:format("%~2.1.0s", [erlang:integer_to_list($+, 16)])).
    "%02"

This doesn't affect the erlang-oauth application in trunk, since it's a more recent version
with a different implementation.


Modified:
    couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl

Modified: couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl?rev=1087662&r1=1087661&r2=1087662&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl (original)
+++ couchdb/branches/1.0.x/src/erlang-oauth/oauth_uri.erl Fri Apr  1 11:56:33 2011
@@ -84,5 +84,5 @@ encode([], Encoded) ->
 encode([C|Etc], Encoded) when ?is_unreserved(C) ->
   encode(Etc, [C|Encoded]);
 encode([C|Etc], Encoded) ->
-  Value = io_lib:format("%~2.1.0s", [erlang:integer_to_list(C, 16)]),
+  Value = io_lib:format("%~2.2.0s", [erlang:integer_to_list(C, 16)]),
   encode(Etc, [Value|Encoded]).