POST, Expect header, and Apache HttpClient (Java)

60 views
Skip to first unread message

Tom Nichols

unread,
Dec 24, 2008, 2:04:04 PM12/24/08
to Twitter Development Talk
There is a similar issue when using Apache HttpClient (a common HTTP
framework for Java). It appears that POST requests will automatically
add an Expect: 100-Continue header. And I suspect this is failing
because HttpClient does not attempt to send auth credentials until
first challenged by a 401 response. So every POST by a client that
doesn't first receive a 401 response will not send the credentials,
and hence get a 417 response when the server can't let the client
"Continue."

Anyway, short answer is, there is a similar solution for HttpClient,
by setting this param on the request object:

request.getParams().setBooleanParameter( "http.protocol.expect-
continue", false );


related to threads:
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/a30dc0bb2fedeecd
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7c67ff1a2407dee7

Hope this helps someone.
Reply all
Reply to author
Forward
0 new messages