我認爲,服務器有一個破碎的IPv6 AAAA記錄。
prd-enforce-xfr-02.dol.gov has address 63.106.133.229
prd-enforce-xfr-02.dol.gov has IPv6 address 2607:f250:d008:2029:63:106:133:129
我無法通過IPv6連接到服務器。使用wget下載後,超時後會回到IPv4。
$ wget --timeout=20 http://prd-enforce-xfr-02.dol.gov/data_catalog/OSHA/osha_accident_abstract_20161019.csv.zip
--2016-10-19 22:40:24-- http://prd-enforce-xfr-02.dol.gov/data_catalog/OSHA/osha_accident_abstract_20161019.csv.zip
Resolving prd-enforce-xfr-02.dol.gov (prd-enforce-xfr-02.dol.gov)... 2607:f250:d008:2029:63:106:133:129, 63.106.133.229
Connecting to prd-enforce-xfr-02.dol.gov (prd-enforce-xfr-02.dol.gov)|2607:f250:d008:2029:63:106:133:129|:80... failed: Connection timed out.
Connecting to prd-enforce-xfr-02.dol.gov (prd-enforce-xfr-02.dol.gov)|63.106.133.229|:80... connected.
HTTP request sent, awaiting response... 200 OK
在rest-client中,Ruby Net :: HTTP可能會做類似的超時。我認爲瀏覽器在快速回退方面要聰明得多。不幸的是,我不確定在rest-client中有一種方法可以禁用IPv6。
對於原始Net :: HTTP,您可以將local_host
設置爲本地IPv4地址以強制使用IPv4。