尝试访问Amazon Cloudfront时,我在使用cURL和PHP时遇到了奇怪的超时。这似乎影响所有失效请求,创建分发等。cURL报告接收0字节或非常少的字节,然后超时: Operation timed out after 120000 milliseconds with 88 out of 619 bytes received
。使用PHP cURL和SSL的奇怪超时
扩展超时设置似乎没有区别。
把使用CURLOPT_VERBOSE
一丝产生这样的输出:
* About to connect() to cloudfront.amazonaws.com port 443 (#0)
* Trying 72.21.215.67... * connected
* Connected to cloudfront.amazonaws.com (72.21.215.67) port 443 (#0)
* skipping SSL peer certificate verification
* SSL connection using SSL_RSA_WITH_RC4_128_MD5
* Server certificate:
* subject: CN=cloudfront.amazonaws.com,O=Amazon.com Inc.,L=Seattle,ST=Washington,C=US
* start date: Jul 30 00:00:00 2010 GMT
* expire date: Jul 29 23:59:59 2013 GMT
* common name: cloudfront.amazonaws.com
* issuer: CN=VeriSign Class 3 Secure Server CA - G2,OU=Terms of use at https://www.verisign.com/rpa (c)09,OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
> POST /2010-11-01/distribution/E1CIM4A92QFD98/invalidation HTTP/1.1
User-Agent: S3/php
Accept: */*
Host: cloudfront.amazonaws.com
Date: Wed, 07 Mar 2012 14:31:58 GMT
Content-Type: application/xml
Authorization: AWS ************************
Content-Length: 200
< HTTP/1.1 201 Created
< x-amzn-RequestId: 4c2d0d3f-6862-11e1-ac27-5531ac8c967f
< Location: https://cloudfront.amazonaws.com/2010-11-01/distribution/E1CIM4A92QFD98/invalidation/I35KLNROKA40FU
* Operation timed out after 120000 milliseconds with 0 bytes received
* Closing connection #0
这似乎类似于this question。然而,看起来在我的情况下,curl实际上得到了回应,但不知何故忽略它并超时?从我看到的回复中收到(201 Created
...),并且没有SSL错误。那么为什么卷曲超时?
卷曲版本信息
[version_number] => 463623
[age] => 3
[features] => 1597
[ssl_version_number] => 0
[version] => 7.19.7
[host] => x86_64-unknown-linux-gnu
[ssl_version] => NSS/3.12.7.0
[libz_version] => 1.2.3
[protocols] => Array ([0] => tftp [1] => ftp [2] => telnet [3] => dict [4] => ldap [5] => ldaps [6] => http [7] => file [8] => https [9] => ftps [10] => scp [11] => sftp)
它说'Content-Type:application/xml'和'Content-Length:200'然后'收到0字节'......它似乎**响应头**到达,但不是这个200字节的XML **答复机构**。 – 2012-03-07 20:33:53
尝试禁用防火墙只做测试并看看会发生什么。 – 2012-03-07 20:36:58
谢谢@ J.Bruni。我相信'Content-Length'头是用于请求的,如果你看得更远,那么服务器('HTTP/1.1 201 Created')和Location头有响应。 '收到0字节'就是问题所在。它确实收到了一些字节,但是curl忽略它们并超时......没有防火墙 – gingerlime 2012-03-07 20:49:27