fix ssl bug

This commit is contained in:
Looly
2024-12-19 14:00:10 +08:00
parent f3d63f85c3
commit f76519351d
3 changed files with 163 additions and 27 deletions

View File

@@ -0,0 +1,28 @@
package org.dromara.hutool.http.client;
import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.http.HttpGlobalConfig;
import org.dromara.hutool.http.HttpUtil;
import org.dromara.hutool.http.client.engine.ClientEngine;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
public class IssueIBC5N8Test {
@Test
@Disabled
public void getBadSSLTest(){
HttpGlobalConfig.setTrustAnyHost(true);
requestBadSSL("httpclient4");
requestBadSSL("httpclient5");
requestBadSSL("okhttp");
requestBadSSL("jdkClient");
}
private void requestBadSSL(final String engineName) {
final ClientEngine engine = HttpUtil.createClient(engineName);
final Request req = Request.of("https://expired.badssl.com/");
final Response res = engine.send(req);
Console.log(res.getStatus());
}
}