You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Andrei Vasilev (Jira)" <ji...@apache.org> on 2022/01/20 19:02:00 UTC

[jira] [Created] (HTTPCLIENT-2198) HttpVersionPolicy is not respected

Andrei Vasilev created HTTPCLIENT-2198:
------------------------------------------

             Summary: HttpVersionPolicy is not respected
                 Key: HTTPCLIENT-2198
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2198
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
    Affects Versions: 5.2-alpha1
            Reporter: Andrei Vasilev
         Attachments: Main.java

The HttpVersionPolicy when set via the new TlsConfig class is not respected due to the wrong data being passed between AbstractClientTlsStrategy and H2TlsSupport.

On line 138 of AbstractClientTlsStrategy, the H2TlsSupport.selectApplicationProtocols() method expects a type of HttpVersionPolicy to be provided, but AbstractClientTlsStrategy passes the entire TlsConfig. Since the types do not match H2TlsSupport defaults to the NEGOTIATE protocol and ignores the value set in TlsConfig.

This results in all sorts of random behavior depending on the target host being requested, but in all cases requests will fail with some sort of error. I have attached a sample program to reproduce the issue.

On a side note, the toString() method of TlsConfig also results in a NullPointerException if all fields are not initialized due to the calling of Arrays.toString() without a null check. I noticed this simply from my debugger telling me.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org