Skip to content

Fixed HTTP timeouts being read as seconds and re-enabled hostname ver… - #219

Open
ReillyBrogan wants to merge 1 commit into
AuthorizeNet:masterfrom
ReillyBrogan:upstream
Open

ReillyBrogan wants to merge 1 commit into
AuthorizeNet:masterfrom
ReillyBrogan:upstream

Conversation

@ReillyBrogan

Copy link
Copy Markdown

…ification

Timeouts: the HttpClient 5 migration wrapped the values in Timeout.ofSeconds(), but the defaults in Constants and anet-java-sdk.properties are in milliseconds (30000). The effective default connect and read timeout therefore became 30,000 seconds (about 8.3 hours). Use Timeout.ofMilliseconds() so the documented unit and the 30 second default are restored. Add HttpClientTest to cover it.

Hostname verification: the HttpClient 5 SSL socket factory was built with NoopHostnameVerifier, so any certificate that chained to a trusted CA was accepted regardless of the host it was issued for. Remove the override so the default verifier is used, as the HttpClient 4 code did with STRICT_HOSTNAME_VERIFIER. Requests to a host with a mismatched certificate now fail with SSLPeerUnverifiedException.

…ification

Timeouts: the HttpClient 5 migration wrapped the values in
Timeout.ofSeconds(), but the defaults in Constants and
anet-java-sdk.properties are in milliseconds (30000). The effective
default connect and read timeout therefore became 30,000 seconds
(about 8.3 hours). Use Timeout.ofMilliseconds() so the documented unit
and the 30 second default are restored. Add HttpClientTest to cover it.

Hostname verification: the HttpClient 5 SSL socket factory was built
with NoopHostnameVerifier, so any certificate that chained to a trusted
CA was accepted regardless of the host it was issued for. Remove the
override so the default verifier is used, as the HttpClient 4 code did
with STRICT_HOSTNAME_VERIFIER. Requests to a host with a mismatched
certificate now fail with SSLPeerUnverifiedException.

Signed-off-by: Reilly Brogan <reilly@reillybrogan.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant