lib/sdb/right_sdb_interface.rb in appoxy-aws-1.11.34 vs lib/sdb/right_sdb_interface.rb in appoxy-aws-1.11.35

- old
+ new

@@ -30,10 +30,11 @@ include RightAwsBaseInterface DEFAULT_HOST = 'sdb.amazonaws.com' DEFAULT_PORT = 443 DEFAULT_PROTOCOL = 'https' + DEFAULT_ENDPOINT = '/' API_VERSION = '2009-04-15' DEFAULT_NIL_REPRESENTATION = 'nil' @@bench = AwsBenchmarkingBlock.new def self.bench_xml; @@bench.xml; end @@ -54,10 +55,11 @@ # :single (same as old multi_thread=>false) # :per_thread (same as old multi_thread=>true) # :pool (uses a connection pool with a maximum number of connections - NOT IMPLEMENTED YET) # :logger => Logger Object # Logger instance: logs to STDOUT if omitted # :nil_representation => 'mynil'} # interpret Ruby nil as this string value; i.e. use this string in SDB to represent Ruby nils (default is the string 'nil') + # :service_endpoint => '/' # Set this to /mdb/request.mgwsi for usage with M/DB # # # Example: # # sdb = RightAws::SdbInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX', {:connection_mode => :per_request, :logger => Logger.new('/tmp/x.log')}) #=> #<RightSdb:0xa6b8c27c> # @@ -67,11 +69,12 @@ @nil_rep = params[:nil_representation] ? params[:nil_representation] : DEFAULT_NIL_REPRESENTATION params.delete(:nil_representation) init({ :name => 'SDB', :default_host => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).host : DEFAULT_HOST, :default_port => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).port : DEFAULT_PORT, - :default_protocol => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).scheme : DEFAULT_PROTOCOL }, + :default_protocol => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).scheme : DEFAULT_PROTOCOL, + :service_endpoint => ENV['SDB_URL'] ? URI.parse(ENV['SDB_URL']).path : DEFAULT_ENDPOINT }, aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'], aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'], params) end @@ -81,10 +84,10 @@ def generate_request(action, params={}) #:nodoc: # remove empty params from request params.delete_if {|key,value| value.nil? } #params_string = params.to_a.collect{|key,val| key + "=#{CGI::escape(val.to_s)}" }.join("&") # prepare service data - service = '/' + service = @params[:service_endpoint] service_hash = {"Action" => action, "AWSAccessKeyId" => @aws_access_key_id, "Version" => API_VERSION } service_hash.update(params) service_params = signed_service_params(@aws_secret_access_key, service_hash, :get, @params[:server], service)