作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我必须使用 TLS 证书和私钥向后端发出请求,在故障排除中,在服务器名称指示中使用相同的主机名时出现错误。请参阅:
我遇到错误:
openssl s_client -connect endpoint.com:443 -servername endpoint.com
我成功了:
openssl s_client -connect endpoint.com:443 -servername another_endpoint_name.com
但是我找不到更改 Apache Lib 中
这可能吗?TLS 握手
中服务器名称指示的方法。
相关问题:How to set SNI (Server Name Indication) in TLS Handshake using Apache HttpComponents Java
最佳答案
可以通过使用 HttpHost
和已解析的 InetAddress
来创建自定义请求路由。
尝试一下这段代码,让我知道是否有效。
CloseableHttpClient httpClient = HttpClients.createSystem();
HttpHost host = new HttpHost(InetAddress.getByName("endpoint.com"), "another_endpoint_name.com", -1, "https");
try (CloseableHttpResponse response = httpClient.execute(host, new HttpGet("https://another_endpoint_name.com/stuff"))) {
System.out.println(response.getStatusLine());
EntityUtils.consume(response.getEntity());
}
关于java - 如何使用 HttpComponents (Java apache lib) 发出请求,更改 TLS 握手中的服务器名称指示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59793862/
假设我们有一个非常复杂的任务。我知道如果我们使用一个线程,那么实际上我们将使用一个内核,但是如果我将任务划分为与处理器内核数量相等的线程,程序是否一定会在所有内核上运行? 或者使用的线程数和内核数与
我是一名优秀的程序员,十分优秀!