Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Workaround in PHP cURL for the 100-continue expectation
<?php
// cURL obeys the RFCs as it should. Meaning that for a HTTP/1.1 backend if the POST size is above 1024 bytes
// cURL sends a 'Expect: 100-continue' header. The server acknowledges and sends back the '100' status code.
// cuRL then sends the request body. This is proper behaviour. Nginx supports this header.
// This allows to work around servers that do not support that header.
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
// We're emptying the 'Expect' header, saying to the server: please accept the body right now.
// Read here: http://pilif.github.com/2007/02/the-return-of-except-100-continue/
@jkoo7yeha

This comment has been minimized.

Copy link

@jkoo7yeha jkoo7yeha commented Apr 21, 2016

)

@mattseabrook

This comment has been minimized.

Copy link

@mattseabrook mattseabrook commented Jan 19, 2018

Thanks for this!

@Jcs1994

This comment has been minimized.

Copy link

@Jcs1994 Jcs1994 commented Jun 12, 2018

ty

@SdVSysAdmin

This comment has been minimized.

Copy link

@SdVSysAdmin SdVSysAdmin commented Jul 18, 2018

thanks

@lsloan

This comment has been minimized.

Copy link

@lsloan lsloan commented Jan 18, 2019

@RicardoOyarzun

This comment has been minimized.

Copy link

@RicardoOyarzun RicardoOyarzun commented Sep 25, 2019

Thank you! You save me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.