Skip to content

Commit

Permalink
Merge pull request #138 from ntalbott/ssl-port-fix
Browse files Browse the repository at this point in the history
Do not treat uri's with a port of 4430 as SSL.
  • Loading branch information
greatuserongithub committed May 5, 2012
2 parents e7a4aaa + a296b1c commit 9c08f47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/httparty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def validate_format

def self.normalize_base_uri(url) #:nodoc:
normalized_url = url.dup
use_ssl = (normalized_url =~ /^https/) || normalized_url.include?(':443')
use_ssl = (normalized_url =~ /^https/) || (normalized_url =~ /:443\b/)
ends_with_slash = normalized_url =~ /\/$/

normalized_url.chop! if ends_with_slash
Expand Down
5 changes: 5 additions & 0 deletions spec/httparty_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
HTTParty.normalize_base_uri(uri)
uri.should == 'http://api.foobar.com'
end

it "should not treat uri's with a port of 4430 as ssl" do
uri = HTTParty.normalize_base_uri('http://api.foo.com:4430/v1')
uri.should == 'http://api.foo.com:4430/v1'
end
end

describe "headers" do
Expand Down

0 comments on commit 9c08f47

Please sign in to comment.