setConnectiontimeout与404无效

问题描述

我的httpclient setConnectiontimeout=5000ms,如果uri有效但路径无效,则建立TCP连接将立即失败,响应码为404,而不是等待5秒钟,为什么?

解决方法

Setconnectiontimeout用于与主机IP建立TCP连接。如果URI有效并且可以建立连接,则此超时将不再适用。

如果路径无效,并且没有超时选项,服务器将立即返回404。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...