ok2c commented on code in PR #407: URL: https://github.com/apache/httpcomponents-core/pull/407#discussion_r1209091896
########## httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java: ########## @@ -424,9 +424,18 @@ private void doHandshake(final IOSession protocolSession) throws IOException { if (this.verifier != null) { this.tlsDetails = this.verifier.verify(this.targetEndpoint, this.sslEngine); } + String applicationProtocol; if (this.tlsDetails == null) { final SSLSession sslSession = this.sslEngine.getSession(); - final String applicationProtocol = this.sslEngine.getApplicationProtocol(); + try { + applicationProtocol = this.sslEngine.getApplicationProtocol(); + } catch (final UnsupportedOperationException e) { + // If the underlying provider does not support the operation, the getApplicationProtocol() method throws an UnsupportedOperationException. + // In this case, we fall back to "http/1.1" as the application protocol. + // This is a workaround to allow older applications that do not support the getApplicationProtocol() method to continue working. + // This workaround is temporary and is meant to maintain compatibility with older systems. + applicationProtocol = "http/1.1"; Review Comment: @arturobernalg Could you please use `ApplicationProtocol` enum here? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org