在netty中添加自帶的SslHandler就能支持HTTPS,但是添加之后使用HTTP訪問是存在問題的。請問如何能支持使用用一個端口兩種協議并行,比如在某個事件中判斷出使用HTTPS協議然后在把SslHandler添加到pipeline中。SelfSignedCertificatessc=newSelfSignedCertificate();SslContextsslCtx=SslContextBuilder.forServer(ssc.certificate(),ssc.privateKey()).build();SSLEnginesslEngine=sslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT);ch.pipeline().addFirst(newSslHandler(sslEngine));
如何讓 netty 同時支持HTTP與HTTPS
白板的微信
2019-05-07 10:12:48