[
https://issues.apache.org/jira/browse/CALCITE-2503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596781#comment-16596781
]
ASF GitHub Bot commented on CALCITE-2503:
-----------------------------------------
Github user karanmehta93 commented on a diff in the pull request:
https://github.com/apache/calcite-avatica/pull/67#discussion_r213811341
--- Diff:
core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java
---
@@ -215,7 +220,9 @@ HostnameVerifier
getHostnameVerifier(HostnameVerification verification) {
final int statusCode = response.getStatusLine().getStatusCode();
if (HttpURLConnection.HTTP_OK == statusCode
|| HttpURLConnection.HTTP_INTERNAL_ERROR == statusCode) {
- return EntityUtils.toByteArray(response.getEntity());
+ byte[] bytes = EntityUtils.toByteArray(response.getEntity());
--- End diff --
Good catch @joshelser
Yes, that works too. Let me update the PR.
Somehow, I believed that the context can only be obtained after getting the
entity, which is wrong.
> AvaticaCommonsHttpClientImpl client needs to set user-token on
> HttpClientContext before sending the request
> -----------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-2503
> URL: https://issues.apache.org/jira/browse/CALCITE-2503
> Project: Calcite
> Issue Type: Improvement
> Reporter: Karan Mehta
> Assignee: Karan Mehta
> Priority: Major
>
> One of the Avatica client implementations, AvaticaCommonsHttpClientImpl, uses
> a PoolingHttpClientConnectionManager. When using mutual authentication on the
> client pool, we need to ensure that we are setting a user-token on the
> HttpClientContext, otherwise it ends up creating a new connection everytime
> and not reusing it. See:
> [https://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html]
> for more details
> This results in significant perf degradation since every new connection tries
> to complete a SSL handshake (which is expensive)
> See:
> https://stackoverflow.com/questions/548029/how-much-overhead-does-ssl-impose
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)