From 2802a688601368bd124cc9ede2d40d47e0b84127 Mon Sep 17 00:00:00 2001 From: Benoit Chesneau Date: Sat, 19 Mar 2011 23:02:29 +0000 Subject: merge trunk. COUCHDB-1094 git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1083325 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/rewrite.js | 33 --------------------------------- src/couchdb/couch_httpd_rewrite.erl | 27 --------------------------- 2 files changed, 60 deletions(-) diff --git a/share/www/script/test/rewrite.js b/share/www/script/test/rewrite.js index 474abb5e..86905f8f 100644 --- a/share/www/script/test/rewrite.js +++ b/share/www/script/test/rewrite.js @@ -90,27 +90,6 @@ couchTests.rewrite = function(debug) { "name": "*" } }, - { - "from": "/type/.json", - "to": "_show/type/:type", - "query": { - "format": "json" - } - }, - { - "from": "/type/.xml", - "to": "_show/type/:type", - "query": { - "format": "xml" - } - }, - { - "from": "/type/", - "to": "_show/type/:type", - "query": { - "format": "html" - } - }, { "from": "/welcome5/*", "to" : "_show/*", @@ -214,9 +193,6 @@ couchTests.rewrite = function(debug) { }), "welcome3": stringFun(function(doc,req) { return "Welcome " + req.query["name"]; - }), - "type": stringFun(function(doc, req) { - return req.id + " as " + req.query.format; }) }, updates: { @@ -404,15 +380,6 @@ couchTests.rewrite = function(debug) { xhr = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/simpleForm/complexView6?a=test&b=essai"); T(xhr.status == 200, "with query params"); T(/Value: doc 4/.test(xhr.responseText)); - - req = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/type/test.json"); - T(req.responseText == "test as json"); - - req = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/type/test.xml"); - T(req.responseText == "test as xml"); - - req = CouchDB.request("GET", "/test_suite_db/_design/test/_rewrite/type/test"); - T(req.responseText == "test as html"); // test path relative to server designDoc.rewrites.push({ diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl index 893f99ed..a8297ae1 100644 --- a/src/couchdb/couch_httpd_rewrite.erl +++ b/src/couchdb/couch_httpd_rewrite.erl @@ -106,15 +106,6 @@ %% {"from": "/a", /a?foo=b /some/b foo =:= b %% "to": "/some/:foo", %% }} -%% -%% {"from": "/a/" /a/b /some/b foo =:= b -%% "to": "/a/b", -%% }} -%% -%% {"from": "/a/.blah" /a/b /some/b foo =:= b -%% "to": "/a/b", -%% }} - @@ -333,14 +324,6 @@ bind_path([?MATCH_ALL], [Match|_RestMatch]=Rest, Bindings) -> {ok, Rest, [{?MATCH_ALL, Match}|Bindings]}; bind_path(_, [], _) -> fail; -bind_path([{bind, {Token, MatchRe}}|RestToken], - [Match|RestMatch],Bindings) -> - case re:run(Match, MatchRe, [{capture, all, binary}]) of - {match, [_, Match1]} -> - bind_path(RestToken, RestMatch, [{{bind, Token}, Match1}|Bindings]); - _ -> - fail - end; bind_path([{bind, Token}|RestToken],[Match|RestMatch],Bindings) -> bind_path(RestToken, RestMatch, [{{bind, Token}, Match}|Bindings]); bind_path([Token|RestToken], [Token|RestMatch], Bindings) -> @@ -418,18 +401,8 @@ path_to_list([<<"..">>|R], Acc, DotDotCount) -> path_to_list(R, [<<"..">>|Acc], DotDotCount+1); path_to_list([P|R], Acc, DotDotCount) -> P1 = case P of - <<"<", _Rest/binary>> -> - {ok, VarRe} = re:compile(<<"<([^>].*)>(.*)">>), - case re:run(P, VarRe, [{capture, all, binary}]) of - {match, [_, Var, Match]} -> - {ok, MatchRe} = re:compile(<<"(.*)", Match/binary>>), - {bind, {Var, MatchRe}}; - _ -> P - end; <<":", Var/binary>> -> to_binding(Var); - - _ -> P end, path_to_list(R, [P1|Acc], DotDotCount). -- cgit v1.2.3