Skip to content

Commit 529e9db

Browse files
author
Nick Hammond
committed
Remove the default ssl version but leave it configurable
1 parent a596f6e commit 529e9db

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/postmark/http_client.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class HttpClient
1818
:secure => true,
1919
:path_prefix => '/',
2020
:http_read_timeout => 15,
21-
:http_open_timeout => 5,
22-
:http_ssl_version => :TLSv1
21+
:http_open_timeout => 5
2322
}
2423

2524
def initialize(api_token, options = {})
@@ -107,7 +106,7 @@ def build_http
107106
http.read_timeout = self.http_read_timeout
108107
http.open_timeout = self.http_open_timeout
109108
http.use_ssl = !!self.secure
110-
http.ssl_version = self.http_ssl_version if http.respond_to?(:ssl_version=)
109+
http.ssl_version = self.http_ssl_version if self.http_ssl_version && http.respond_to?(:ssl_version=)
111110
http
112111
end
113112
end

spec/unit/postmark/http_client_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def response_body(status, message = "")
4242
its(:http_read_timeout) { is_expected.to eq 15 }
4343
its(:http_open_timeout) { is_expected.to eq 5 }
4444

45-
it 'use default TLS encryption', :skip_ruby_version => ['1.8.7'] do
45+
it 'does not provide a default which utilizes the Net::HTTP default', :skip_ruby_version => ['1.8.7'] do
4646
http_client = subject.http
47-
expect(http_client.ssl_version).to eq :TLSv1
47+
expect(http_client.ssl_version).to eq nil
4848
end
4949
end
5050

@@ -140,7 +140,7 @@ def response_body(status, message = "")
140140
:status => [ "485", "Custom HTTP response status" ])
141141
expect { subject.post(target_path) }.to raise_error Postmark::UnknownError
142142
end
143-
143+
144144
end
145145

146146
describe "#get" do
@@ -180,7 +180,7 @@ def response_body(status, message = "")
180180
:status => [ "485", "Custom HTTP response status" ])
181181
expect { subject.get(target_path) }.to raise_error Postmark::UnknownError
182182
end
183-
183+
184184
end
185185

186186
describe "#put" do
@@ -223,4 +223,4 @@ def response_body(status, message = "")
223223
expect { subject.put(target_path) }.to raise_error Postmark::UnknownError
224224
end
225225
end
226-
end
226+
end

0 commit comments

Comments
 (0)