Repository navigation
Fixed HTTP timeouts being read as seconds and re-enabled hostname ver… - #219
Open
ReillyBrogan wants to merge 1 commit into
Open
ReillyBrogan wants to merge 1 commit into
ReillyBrogan wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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.