lib/fakes3/server.rb in fakes3-0.2.2 vs lib/fakes3/server.rb in fakes3-0.2.3
- old
+ new
@@ -7,10 +7,11 @@
require 'fakes3/file_store'
require 'fakes3/xml_adapter'
require 'fakes3/bucket_query'
require 'fakes3/unsupported_operation'
require 'fakes3/errors'
+require 'ipaddr'
module FakeS3
class Request
CREATE_BUCKET = "CREATE_BUCKET"
LIST_BUCKETS = "LIST_BUCKETS"
@@ -450,10 +451,10 @@
s_req = Request.new
s_req.path = webrick_req.path
s_req.is_path_style = true
- if !@root_hostnames.include?(host)
+ if !@root_hostnames.include?(host) && !(IPAddr.new(host) rescue nil)
s_req.bucket = host.split(".")[0]
s_req.is_path_style = false
end
s_req.http_verb = webrick_req.request_method