Skip to content

Commit

Permalink
disable curl sleep behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
daaku committed Jul 13, 2010
1 parent 24c2e45 commit d82c866
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/facebook.php
Expand Up @@ -505,6 +505,17 @@ protected function makeRequest($url, $params, $ch=null) {
$opts = self::$CURL_OPTS;
$opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');
$opts[CURLOPT_URL] = $url;

// disable the 'Expect: 100-continue' behaviour. This causes CURL to wait
// for 2 seconds if the server does not support this header.
if (isset($opts[CURLOPT_HTTPHEADER])) {
$existing_headers = $opts[CURLOPT_HTTPHEADER];
$existing_headers[] = 'Expect:';
$opts[CURLOPT_HTTPHEADER] = $existing_headers;
} else {
$opts[CURLOPT_HTTPHEADER] = array('Expect:');
}

curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
if ($result === false) {
Expand Down

0 comments on commit d82c866

Please sign in to comment.