Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpProtocolParams.setUseExpectContinue(params, false) - when to set true?

I am using org.apache.http.impl.client.DefaultHttpClient to retrieve xml from a webservice and am trying to determine whether to set

HttpProtocolParams.setUseExpectContinue(params, true) 

or

HttpProtocolParams.setUseExpectContinue(params, false)

I am not clear on how to determine this. Can anyone offer a best practices guideline on when this should be true and when it should be false and also the possible implications of each setting?

like image 527
JohnRock Avatar asked May 08 '10 19:05

JohnRock


1 Answers

It should be false in most cases.

Expect-Continue is only needed when your request is large (like file uploading) and the server may have authorization requirement. You don't want send a huge file and get a Access Denied error. So you just send the headers first and if the server says continue, you will then send the whole request.

We had some performance problem with a Curl-based system and we found out 100-Continue is causing the request being send twice. It turns out Curl has 100-Continue turned on by default.

like image 63
ZZ Coder Avatar answered Oct 20 '22 18:10

ZZ Coder