You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Jean-Noel Rouvignac (Jira)" <ji...@apache.org> on 2021/02/05 17:33:00 UTC

[jira] [Commented] (HTTPCORE-666) Upgrade to 5.1-beta3 breaks behaviour from 5.0.x code

    [ https://issues.apache.org/jira/browse/HTTPCORE-666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17279842#comment-17279842 ] 

Jean-Noel Rouvignac commented on HTTPCORE-666:
----------------------------------------------

Sorry I don't have time to submit a patch / unit tests for now since I'll be on holidays for the coming week.

> Upgrade to 5.1-beta3 breaks behaviour from 5.0.x code
> -----------------------------------------------------
>
>                 Key: HTTPCORE-666
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-666
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 5.1-beta1, 5.1-beta2, 5.1-beta3
>            Reporter: Jean-Noel Rouvignac
>            Priority: Major
>
> Here is the commit that broke the behaviour: https://github.com/apache/httpcomponents-core/commit/49591ef92cf6900e71d77e3c84e660b57dd25e1a
> And more specifically the change to {{ServerHttp1IOEventHandlerFactory.createHandler(): 
> https://github.com/apache/httpcomponents-core/commit/49591ef92cf6900e71d77e3c84e660b57dd25e1a#diff-20589ec1cfdba10cb3a20ca94611e09a928e533fa60d311af1a25e8157ca01bf
> Our code takes the else branch, and the behaviour has changed there.
> To make all our tests pass again, the following patch restores the previous behaviour:
> {code}
> diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java
> index 111f6152d..db316097d 100644
> --- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java
> +++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ServerHttp1IOEventHandlerFactory.java
> @@ -75,13 +75,15 @@ public IOEventHandler createHandler(final ProtocolIOSession ioSession, final Obj
>                          handshakeTimeout);
>              }
>          } else {
> -            tlsStrategy.upgrade(
> -                    ioSession,
> -                    null,
> -                    ioSession.getLocalAddress(),
> -                    ioSession.getRemoteAddress(),
> -                    attachment,
> -                    handshakeTimeout);
> +            if (tlsStrategy != null && tlsStrategy.upgrade(
> +                        ioSession,
> +                        null,
> +                        ioSession.getLocalAddress(),
> +                        ioSession.getRemoteAddress(),
> +                        attachment,
> +                        handshakeTimeout)) {
> +                endpointScheme = URIScheme.HTTPS.id;
> +            }
>          }
>          return new ServerHttp1IOEventHandler(streamDuplexerFactory.create(endpointScheme, ioSession));
>      }
> {code}
> {{(attachment instanceof EndpointParameters)}} returns {{false}} in our case.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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