cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Fail to fetch body using curl_easy_perform

From: 陳昱均 <yuchunchen_at_gvdigital.com>
Date: Wed, 02 Sep 2009 11:47:09 +0800

Daniel Stenberg 提到:
> On Tue, 1 Sep 2009, 陳昱均 wrote:
>
>> I faced a problem that I can’t fetch the response body using the
>> curl_easy_perform. The same code I used works well before.
>
> So what changed?
Nothing changed, except the remote server or url we sent.
>
>> As my observation, it seems that if the header and body at the
>> different packets.
>
> That's not that uncommon but it's not a problem to libcurl.
>
>> I attached a segment of the packets I captured.
>
> Using CURLOPT_VERBOSE or CURLOPT_DEBUGFUNCTION will get you more and
> better details to track this problem from.
>
> And you say it fails, but can you please elaborate on exactly what it
> does?
>
The information using the CURLOPT_VERBOSE is listed below.
The version we used is CURLv.7.16.2
======================================
* About to connect() to 192.168.10.143 port 80 (#0)
* Trying 192.168.10.143... * connected
* Connected to 192.168.10.143 (192.168.10.143) port 80 (#0)
> GET /cgi-bin/viewer/video.jpg HTTP/1.1
Host: 192.168.10.143
Accept: */*
Connection: Keep-Alive

< HTTP/1.1 401 Unauthorized
< Date: Thu, 03 Feb 2000 07:03:58 GMT
< Server: Boa/0.94.14rc21
< Accept-Ranges: bytes
< Connection: close
< WWW-Authenticate: Basic realm="streaming_server"
< Content-Type: text/html; charset=ISO-8859-1
<
* Closing connection #0
* Issue another request to this URL:
'http://192.168.10.143:80/cgi-bin/viewer/video.jpg'
* About to connect() to 192.168.10.143 port 80 (#0)
* Trying 192.168.10.143... * connected
* Connected to 192.168.10.143 (192.168.10.143) port 80 (#0)
* Server auth using Basic with user 'root'
> GET /cgi-bin/viewer/video.jpg HTTP/1.1
Authorization: Basic cm9vdDpzeXN0ZW0=
Host: 192.168.10.143
Accept: */*
Connection: Keep-Alive

< HTTP/1.1 200 OK
< Content-type: image/jpeg
<
* Connection #0 to host 192.168.10.143 left intact
* Closing connection #0
======================================

It seems that the only different commnet(* part) CURL print is
"Connection #0 to host 192.168.10.143 left intact",
when comparing to those I can get the body correctly.
For example(success case),
======================================
< HTTP/1.1 200 OK
< Date: Tue, 04 Jan 2000 22:22:34 GMT
< Server: Boa/0.94.14rc21
< Accept-Ranges: bytes
< Connection: close
< Content-type: image/jpeg
<
* Closing connection #0
======================================

It's really appreciated for your reply.
Best Regards,
YC
Received on 2009-09-02