couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r806983 - in /couchdb/trunk: share/www/script/test/oauth.js src/couchdb/couch_httpd_oauth.erl
Date Sun, 23 Aug 2009 14:51:24 GMT
Author: jan
Date: Sun Aug 23 14:51:24 2009
New Revision: 806983

URL: http://svn.apache.org/viewvc?rev=806983&view=rev
Log:
fix HEAD requests for OAuth, patch by Jason Davies, closes COUCHDB-479

Modified:
    couchdb/trunk/share/www/script/test/oauth.js
    couchdb/trunk/src/couchdb/couch_httpd_oauth.erl

Modified: couchdb/trunk/share/www/script/test/oauth.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/oauth.js?rev=806983&r1=806982&r2=806983&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/oauth.js (original)
+++ couchdb/trunk/share/www/script/test/oauth.js Sun Aug 23 14:51:24 2009
@@ -133,6 +133,10 @@
           xhr = oauthRequest("http://" + host + "/_session?foo=bar", message, accessor);
           T(xhr.status == expectedCode);
 
+          // Test HEAD method
+          xhr = oauthRequest("http://" + host + "/_session?foo=bar", message, accessor, "HEAD");
+          T(xhr.status == expectedCode);
+
           // Replication
           var result = CouchDB.replicate(dbPair.source, dbPair.target);
           T(result.ok);

Modified: couchdb/trunk/src/couchdb/couch_httpd_oauth.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_oauth.erl?rev=806983&r1=806982&r2=806983&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_oauth.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_oauth.erl Sun Aug 23 14:51:24 2009
@@ -16,11 +16,11 @@
 -export([oauth_authentication_handler/1, handle_oauth_req/1, consumer_lookup/2]).
 
 % OAuth auth handler using per-node user db
-oauth_authentication_handler(#httpd{method=Method}=Req) ->
+oauth_authentication_handler(#httpd{mochi_req=MochiReq}=Req) ->
     serve_oauth(Req, fun(URL, Params, Consumer, Signature) ->
         AccessToken = proplists:get_value("oauth_token", Params),
         TokenSecret = couch_config:get("oauth_token_secrets", AccessToken),
-        case oauth:verify(Signature, atom_to_list(Method), URL, Params, Consumer, TokenSecret)
of
+        case oauth:verify(Signature, atom_to_list(MochiReq:get(method)), URL, Params, Consumer,
TokenSecret) of
             true ->
                 set_user_ctx(Req, AccessToken);
             false ->



Mime
View raw message