title: Strange timeout with PHP cURL and SSL
body: <p>I'm experiencing strange timeouts using cURL with PHP when trying to access Amazon Cloudfront. This seems to affect all invalidation requests, creating distributions etc. cURL either reports receiving 0 bytes, or very few bytes, and then time-out: 
  <code>Operation timed out after 120000 milliseconds with 88 out of 619 bytes received</code>. </p>
  
  <p>Extending the timeout settings does not seem to make a difference.</p>
  
  <p>Putting a trace using <code>CURLOPT_VERBOSE</code> produces this output:</p>
  
  <pre><code>* 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
  &gt; 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
  
  &lt; HTTP/1.1 201 Created
  &lt; x-amzn-RequestId: 4c2d0d3f-6862-11e1-ac27-5531ac8c967f
  &lt; 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
  </code></pre>
  
  <p>This seems similar to <a href="https://stackoverflow.com/q/2950417/305019">this question</a>. However, it looks like in my case curl does in fact get a response, but somehow ignores it and times-out? From what I see, the response is received (<code>201 Created</code>...), and there are no SSL errors. So why does curl time-out??</p>
  
  <p>cURL version info</p>
  
  <pre><code>[version_number] =&gt; 463623 
  [age] =&gt; 3 
  [features] =&gt; 1597 
  [ssl_version_number] =&gt; 0 
  [version] =&gt; 7.19.7 
  [host] =&gt; x86_64-unknown-linux-gnu 
  [ssl_version] =&gt; NSS/3.12.7.0 
  [libz_version] =&gt; 1.2.3 
  [protocols] =&gt; Array ( [0] =&gt; tftp [1] =&gt; ftp [2] =&gt; telnet [3] =&gt; dict [4] =&gt; ldap [5] =&gt; ldaps [6] =&gt; http [7] =&gt; file [8] =&gt; https [9] =&gt; ftps [10] =&gt; scp [11] =&gt; sftp )
  </code></pre>