Skip to content

Commit

Permalink
apply pull request jubos#88 from jubos/fake-s3 (by Allactaga)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Chinchilla Carbonell committed Sep 17, 2015
1 parent e7b4f00 commit f0c472c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fakes3/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def initialize(server,store,hostname)
@hostname = hostname
@port = server.config[:Port]
@root_hostnames = [hostname,'localhost','s3.amazonaws.com','s3.localhost']
escaped_hostnames = @root_hostnames.map { |host| Regexp.escape(host) }
@bucket_host_regex = Regexp.new('^(.*?)\.(?:%s)$' % escaped_hostnames.join('|'))
end

def validate_request(request)
Expand Down Expand Up @@ -466,7 +468,7 @@ def normalize_request(webrick_req)
s_req.is_path_style = true

if !@root_hostnames.include?(host)
s_req.bucket = host.split(".")[0]
s_req.bucket = @bucket_host_regex.match(host)[1]
s_req.is_path_style = false
end

Expand Down

0 comments on commit f0c472c

Please sign in to comment.