couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r643220 - /incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
Date Tue, 01 Apr 2008 00:01:03 GMT
Author: cmlenz
Date: Mon Mar 31 17:01:02 2008
New Revision: 643220

URL: http://svn.apache.org/viewvc?rev=643220&view=rev
Log:
mochiweb branch: Use mochiweb function for URL unquoting.

Modified:
    incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl?rev=643220&r1=643219&r2=643220&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_httpd.erl Mon Mar 31 17:01:02 2008
@@ -127,7 +127,7 @@
 handle_db_request(Req, Method, {Path}) ->
     UriParts = string:tokens(Path, "/"),
     [DbName|Rest] = UriParts,
-    handle_db_request(Req, Method, {url_decode(DbName), Rest});
+    handle_db_request(Req, Method, {mochiweb_util:unquote(DbName), Rest});
 
 handle_db_request(Req, 'PUT', {DbName, []}) ->
     case couch_server:create(DbName, []) of
@@ -361,7 +361,7 @@
 % Document request handlers
 
 handle_db_request(Req, Method, {DbName, Db, [Resource]}) ->
-    DocId = url_decode(Resource),
+    DocId = mochiweb_util:unquote(Resource),
     handle_doc_request(Req, Method, DbName, Db, DocId).
 
 handle_doc_request(Req, 'DELETE', _DbName, Db, DocId) ->
@@ -721,11 +721,3 @@
 end_json_response(Resp) ->
     Resp:write_chunk(""),
     {ok, Resp}.
-
-url_decode([$%, Hi, Lo | Tail]) ->
-    Hex = erlang:list_to_integer([Hi, Lo], 16),
-    xmerl_ucs:to_utf8([Hex]) ++ url_decode(Tail);
-url_decode([H|T]) ->
-    [H |url_decode(T)];
-url_decode([]) ->
-    [].



Mime
View raw message