cURL / Mailing Lists / curl-library / Single Mail

curl-library

how libcurl receives chunked data from http server?

From: Jerry G. Chiuan <jerry_at_oridus.com>
Date: Sat, 20 Sep 2003 10:28:37 -0700

Hi All,
My http server responds to the client a huge data that can't be carried by single TCP segment.
the data size = 1160 + 1460*6 + 337 = 10,257 (bytes), please refer to info. shown below

As a result, it needs totally 8 TCP segments to transfer, the first one carries http header.

My question is:
- can libcurl handle this kind of response?
Its header has the field called "Transfer-Encoding: chunked", meanwhile it has "1ff8" between http header part and http data part in the first TCP segment.

I have no idea why it carries "1ff8" between http header and http data. is it for encoding?
supposely the http header shall ends with "....", then followed by data part directly, right?

- If yes, can libcurl receive all binary data at a time in libcurl's buffer?
I found that CURLOPT_WRITEFUNCTION would be called several times in order to receive the whole data.
For instance, it might receive first 2 packets, then receive the rest etc...
how can we receive the data at a time with libcurl? can it be configured?

The following are payloads of these 8 TCP segments:

[1460 byte(s) of data]
 HTTP/1.1 200 OK
 Date: Sat, 20 Sep 2003 16:36:20 GMT
 Server: Apache/2.0.43 (Unix) mod_ssl/2.0.43 OpenSSL/0.9.6b mod_jk/1.2.1
 Pragma: no-cache
 Cache-Control: no-cache
 Keep-Alive: timeout=6
 Connection: Keep-Alive
 Transfer-Encoding: chunked
 Content-Type: text/plain; charset=ISO-8859-1
 1ff8
 Binary Data: 1160

[1460 byte(s) of binary data]
[1460 byte(s) of binary data]
[1460 byte(s) of binary data]
[1460 byte(s) of binary data]
[1460 byte(s) of binary data]
[1460 byte(s) of binary data]
[337 byte(s) of binary data]

Regds,
-Jerry

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-20