cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: transfer closed with outstanding read data remaining with Expect: 100-continue

From: Emanuel Norrbin <emanuel.norrbin_at_jitterbit.com>
Date: Tue, 21 Oct 2008 11:16:13 -0700

>
>
> /> HTTP/1.1 100 Continue /
> /> Content-Length: 0 /
> /> /
> /> then I send the data and get the following headers back: /
>
> I wonder if perhaps the funny Content-Length: after the 100 Continue
> can cause
> some problem.
>
> Did you try sending the POST with Expect: 100 continue disabled?
Daniel,

I did not try that. I have now and the result is a success! Here is the
curl debug output with 100 Continue disabled (I also disabled transfer
content encoding which by itself does not make any difference)
-----
CURL DEBUG HEADER_OUT: POST /services/Soap/c/9.0/4c1600D3000000018EC
HTTP/1.1
Host: na2-api.salesforce.com
Accept: */*
Content-Type: text/xml; charset="utf-8"
SOAPAction: ""
Content-Length: 1290
CURL DEBUG DATA_OUT: <Output data removed>
CURL DEBUG HEADER_IN: HTTP/1.1 200 OK
CURL DEBUG HEADER_IN: Server:
CURL DEBUG HEADER_IN: Content-Type: text/xml; charset=utf-8
CURL DEBUG HEADER_IN: Transfer-Encoding: chunked
CURL DEBUG HEADER_IN: Date: Tue, 21 Oct 2008 17:49:23 GMT
CURL DEBUG HEADER_IN:
CURL DEBUG DATA_IN: 3f75
<Input data removed>
0

CURL DEBUG TEXT: Connection #0 to host na2-api.salesforce.com left intact
CURL DEBUG TEXT: Closing connection #0
CURL DEBUG TEXT: SSLv3, TLS alert, Client hello (1):
-----

This time the server does not send that Content-Length: 0 header back
and it all works as expected.
For your reference, the conversation that fails looks like this (with
content encoding also turned off):
-----
CURL DEBUG HEADER_OUT: POST /services/Soap/c/9.0/4c1600D3000000018EC
HTTP/1.1
Host: na2-api.salesforce.com
Accept: */*
Content-Type: text/xml; charset="utf-8"
SOAPAction: ""
Content-Length: 1290
Expect: 100-continue

CURL DEBUG HEADER_IN: HTTP/1.1 100 Continue
CURL DEBUG HEADER_IN: Server:
CURL DEBUG HEADER_IN: Content-Length: 0
CURL DEBUG HEADER_IN: Date: Tue, 21 Oct 2008 17:47:40 GMT
CURL DEBUG DATA_OUT: <Output data removed>
CURL DEBUG HEADER_IN: HTTP/1.1 200 OK
CURL DEBUG HEADER_IN: Server:
CURL DEBUG HEADER_IN: Content-Type: text/xml; charset=utf-8
CURL DEBUG HEADER_IN: Transfer-Encoding: chunked
CURL DEBUG HEADER_IN: Date: Tue, 21 Oct 2008 17:47:41 GMT
CURL DEBUG HEADER_IN:
CURL DEBUG TEXT: transfer closed with outstanding read data remaining
CURL DEBUG TEXT: Closing connection #0
CURL DEBUG TEXT: SSLv3, TLS alert, Client hello (1):
CURL DEBUG UNKNOWN: 
-----

Could it be that curl is looking at that Content-Length set to 0 and
then does not expect chunked transfer encoding of the input data?

As it is now I have two solutions to the problem: Send
"Transfer-Encoding: chunked" header or don't send "Expect: 100-continue"
header. In both cases the server does not send the "Content-Length: 0"
header back so you may be on to something.

/Thanks
Emanuel
Received on 2008-10-21