Kouhei Sutou
null+****@clear*****
Fri Feb 16 17:13:42 JST 2018
Kouhei Sutou 2018-02-16 17:13:42 +0900 (Fri, 16 Feb 2018) New Revision: 82311bd667913156159134a9ea5369ccecec8b74 https://github.com/ranguba/groonga-client/commit/82311bd667913156159134a9ea5369ccecec8b74 Message: Support not "/d/" path Modified files: lib/groonga/client.rb lib/groonga/client/protocol/http/path-resolvable.rb Modified: lib/groonga/client.rb (+10 -1) =================================================================== --- lib/groonga/client.rb 2018-02-16 16:54:55 +0900 (3154e77) +++ lib/groonga/client.rb 2018-02-16 17:13:42 +0900 (5d50c12) @@ -222,7 +222,7 @@ module Groonga scheme = (options.delete(:protocol) || "gqtp").to_s host = options.delete(:host) || options.delete(:address) || "127.0.0.1" port = options.delete(:port) || default_port(scheme) - path = options.delete(:path) + path = options.delete(:path) || default_path(schema) user = options.delete(:user) password = options.delete(:password) if user and password @@ -263,6 +263,15 @@ module Groonga end end + def default_path(scheme) + case scheme + when "http", "https" + "/d/" + else + nil + end + end + def groonga_command_name?(name) /\A[a-zA-Z][a-zA-Z\d_]+\z/ === name.to_s end Modified: lib/groonga/client/protocol/http/path-resolvable.rb (+6 -1) =================================================================== --- lib/groonga/client/protocol/http/path-resolvable.rb 2018-02-16 16:54:55 +0900 (fa0f3fa) +++ lib/groonga/client/protocol/http/path-resolvable.rb 2018-02-16 17:13:42 +0900 (b4c3be5) @@ -21,7 +21,12 @@ module Groonga module PathResolvable private def resolve_path(uri, path) - uri.path.chomp("/") + path + path_prefix = uri.path.chomp("/") + if path_prefix.empty? + path + else + path.sub(/\A\/d/) {path_prefix} + end end end end -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180216/818c2a8b/attachment-0001.htm