Jump to content
xisto Community
Sign in to follow this  
c0kr3x

Help: Removing A Specific Header With cURL

Recommended Posts

Hi all,

 

I' ve problem sending HTTP POST(multipart/form-data) request using CURL. The server always reply with HTTP/1.1 417 Expectation Failed. Then I review my code and the tcp packet using wireshark for long long time ;) just to figure out where is the error!. This problem only for one site and for the others site my script works perfectly!.

 

here is my packet that sent to the server

POST xxxxxxxx HTTP/1.1Cookie: PHPSESSID=447c6f5c9e73c22a1bf50dd46940306eHost: xxxxxxxxxx.comAccept; text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5Accept-Language: en-us,en;q=0.5Accept-Encoding: gzip,deflateAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7Keep-Alive: 300Connection: keep-aliveReferer: http://http://www.sexyxxx.com/; Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0Content-Length: 1096Expect: 100-continue(anti-spam-content-type:) multipart/form-data; boundary=----------------------------14293c2adb1d<< THE DATA >>

And here is the server response

HTTP/1.1 417 Expectation FailedConnection: closeContent-Length: 0Date: Tue, 30 Jan 2007 07:19:41 GMTServer: lighttpd/1.4.8Connection: closeContent-Length: 0Date: Tue, 30 Jan 2007 07:19:41 GMTServer: lighttpd/1.4.8

After googling for while, i found that the error is not on my code but the server(lighttpd) bug. Based on Daniel Stenberg(https://curl.haxx.se/mail/archive-2005-11/0127.html) we have to remove header (Expect: 100-continue) using command -H "Expect: ". Yeah but it's for curl executable, how to doit on PHP/CURL?. If set up curl_setopt($ch, CURLOPT_POSTFIELDS, $foo) PHP curl always sent Expect Header. I've searching everywhere but i couldn't find useful help. Any body knows what PHP/CURL command to remove certain header that we specified?

 

Thanks

 

Rio Astamal ;)

Edited by masterio (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.