Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit c355cbc

Browse files
committed
Add SSL peer verification option to HTTP client
1 parent cb1a195 commit c355cbc

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

lib/wpxf/net/http_client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def initialize_advanced_options
3535
HTTP_OPTION_MAX_CONCURRENCY,
3636
HTTP_OPTION_CLIENT_TIMEOUT,
3737
HTTP_OPTION_USER_AGENT,
38-
HTTP_OPTION_FOLLOW_REDIRECT
38+
HTTP_OPTION_FOLLOW_REDIRECT,
39+
HTTP_OPTION_PEER_VERIFICATION
3940
])
4041

4142
set_option_value('user_agent', random_user_agent)

lib/wpxf/net/http_options.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ module HttpOptions
5858
default: true
5959
)
6060

61+
HTTP_OPTION_PEER_VERIFICATION = BooleanOption.new(
62+
name: 'verify_peer',
63+
desc: 'Enable peer verification when using HTTPS',
64+
required: true,
65+
default: true
66+
)
67+
6168
HTTP_OPTION_MAX_CONCURRENCY = IntegerOption.new(
6269
name: 'max_http_concurrency',
6370
desc: 'Max number of HTTP requests that can be made in '\

lib/wpxf/net/typhoeus_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def advanced_typhoeus_options
88
proxy: datastore['proxy'],
99
proxyuserpwd: datastore['proxy_auth_creds'],
1010
ssl_verifyhost: normalized_option_value('verify_host') ? 2 : 0,
11+
ssl_verifypeer: normalized_option_value('verify_peer'),
1112
timeout: normalized_option_value('http_client_timeout')
1213
}
1314
end

0 commit comments

Comments
 (0)