Skip to content

Commit

Permalink
#3 Fixed issue with cURL sending HTTP/1.1 100 Continue if request is …
Browse files Browse the repository at this point in the history
…too big
  • Loading branch information
staticall committed Jul 11, 2018
1 parent 2f2b2a7 commit 074d380
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Api/Odr.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,18 @@ protected function _execute($url = '', $method = self::DEFAULT_METHOD, array $da
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
}

if (count($this->_headers) > 0) {
$headers = array();
$headers = array();

if (count($this->_headers) > 0) {
foreach ($this->_headers as $k => $v) {
$headers[] = $k .': '. $v;
$headers[] = $k . ': ' . $v;
}

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
}

$headers[] = 'Expect:'; // Prevent cURL from sending HTTP/1.1 100 Continue (thanks to @githubbauman)

curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);

list($resultHeaders, $resultBody) = explode("\r\n\r\n", $result, 2);
Expand Down

0 comments on commit 074d380

Please sign in to comment.