curl-library
HTTP GET
Date: Thu, 24 Aug 2006 16:13:44 -0700
Hi,
I have a few questions on the using HTTP get and using the set opts
1. If I don't provide a call back function and just use WRITEDATA
and pass in a FILE* (-fopen with wb) I get a write failure. Would you
please let me know if I am using this correctly?
2. If I use the NOBODY option the header content gets dumped on the
screen. If I use the HEADERFUNCTION option where the function does
something like
int headget(void *buffer, size_t size, size_t nmemb, void *stream)
{
struct HttpFile *out=(struct HttpFile *)stream;
if(out && !out->stream) {
/* open file for writing */
out->stream=fopen(out->filename, "wb");
if(!out->stream)
return -1; /* failure, can't open file to write */
}
char* bufferc = (char*)buffer;
if(strncmp("Content-Length:",bufferc,15) == 0)
{
size = atoi(bufferc+16);
}
printf("In headget %s\n", bufferc);
return size*nmemb;
}
I get
160940 PID:23effa3e TID:23e30fc6 0x83dfebac: InitSharedHeap: 46000000 0
c
160950 PID:23effa3e TID:23e30fc6 0x83dfebac: InitSharedHeap: return
46000060
161230 PID:23effa3e TID:23e30fc6 0x83dfebac: Console redirected to
DEBUG for process 0x23EFFA3E
161410 PID:23effa3e TID:23e30fc6 Done
161490 PID:23effa3e TID:23e30fc6 *
161500 PID:23effa3e TID:23e30fc6
161500 PID:23effa3e TID:23e30fc6 A
161500 PID:23effa3e TID:23e30fc6 bout to connect() to 192.168.117.1
port 80
161560 PID:23effa3e TID:23e30fc6 0x83dfebac: >>> Loading module
ssllsp.dll at address 0x03B50000-0x03B61000 (RW data at
0x01FB0000-0x01FB1055)
161630 PID:23effa3e TID:23e30fc6 0x83dfebac: >>> Loading module
wspm.dll at address 0x03B80000-0x03B85000 (RW data at
0x01FB5000-0x01FB5154)
161710 PID:23effa3e TID:23e30fc6 *
161710 PID:23effa3e TID:23e30fc6
161710 PID:23effa3e TID:23e30fc6
161710 PID:23effa3e TID:23e30fc6 Trying 192.168.117.1...
161950 PID:23effa3e TID:23e30fc6 *
161950 PID:23effa3e TID:23e30fc6
161960 PID:23effa3e TID:23e30fc6 c
161960 PID:23effa3e TID:23e30fc6 onnected
161960 PID:23effa3e TID:23e30fc6 *
161960 PID:23effa3e TID:23e30fc6
161960 PID:23effa3e TID:23e30fc6 C
161960 PID:23effa3e TID:23e30fc6 onnected to 192.168.117.1
(192.168.117.1) port 80
162030 PID:23effa3e TID:23e30fc6 >
162030 PID:23effa3e TID:23e30fc6
162030 PID:23effa3e TID:23e30fc6 H
162030 PID:23effa3e TID:23e30fc6 EAD /minitris/test.zip HTTP/1.1
Host: 192.168.117.1
Accept: */*
162100 PID:23effa3e TID:23e30fc6 <
162100 PID:23effa3e TID:23e30fc6
162110 PID:23effa3e TID:23e30fc6 H
162110 PID:23effa3e TID:23e30fc6 TTP/1.1 200 OK
162110 PID:23effa3e TID:23e30fc6 In headget HTTP/1.1 200 OK
162120 PID:23effa3e TID:23e30fc6 <
162120 PID:23effa3e TID:23e30fc6
162120 PID:23effa3e TID:23e30fc6 D
162120 PID:23effa3e TID:23e30fc6 ate: Thu, 24 Aug 2006 22:59:47 GMT
162120 PID:23effa3e TID:23e30fc6 In headget Date: Thu, 24 Aug 2006
22:59:47 GMT
162120 PID:23effa3e TID:23e30fc6 <
162120 PID:23effa3e TID:23e30fc6
162120 PID:23effa3e TID:23e30fc6 S
162130 PID:23effa3e TID:23e30fc6 erver: Apache/2.2.2 (Win32)
162130 PID:23effa3e TID:23e30fc6 In headget Server: Apache/2.2.2
(Win32)
162130 PID:23effa3e TID:23e30fc6 <
162130 PID:23effa3e TID:23e30fc6
162130 PID:23effa3e TID:23e30fc6 L
162130 PID:23effa3e TID:23e30fc6 ast-Modified: Wed, 22 Jun 2005
07:00:00 GMT
162130 PID:23effa3e TID:23e30fc6 In headget Last-Modified: Wed, 22 Jun
2005 07:00:00 GMT
162130 PID:23effa3e TID:23e30fc6 <
162130 PID:23effa3e TID:23e30fc6
162130 PID:23effa3e TID:23e30fc6 E
162140 PID:23effa3e TID:23e30fc6 Tag: "5dffc-adf-1e07fc00"
162140 PID:23effa3e TID:23e30fc6 In headget ETag: "5dffc-adf-1e07fc00"
162140 PID:23effa3e TID:23e30fc6 <
162140 PID:23effa3e TID:23e30fc6
162140 PID:23effa3e TID:23e30fc6 A
162140 PID:23effa3e TID:23e30fc6 ccept-Ranges: bytes
162140 PID:23effa3e TID:23e30fc6 In headget Accept-Ranges: bytes
162140 PID:23effa3e TID:23e30fc6 <
162140 PID:23effa3e TID:23e30fc6
162140 PID:23effa3e TID:23e30fc6 C
162140 PID:23effa3e TID:23e30fc6 ontent-Length: 2783
162140 PID:23effa3e TID:23e30fc6 In headget Content-Length: 2783
162140 PID:23effa3e TID:23e30fc6 *
162140 PID:23effa3e TID:23e30fc6
162150 PID:23effa3e TID:23e30fc6 F
162150 PID:23effa3e TID:23e30fc6 ailed writing header
162160 PID:23effa3e TID:23e30fc6 *
162160 PID:23effa3e TID:23e30fc6
162160 PID:23effa3e TID:23e30fc6 C
162160 PID:23effa3e TID:23e30fc6 losing connection #0
162240 PID:23effa3e TID:23e30fc6 *
162240 PID:23effa3e TID:23e30fc6
162240 PID:23effa3e TID:23e30fc6 f
162240 PID:23effa3e TID:23e30fc6 ailed writing received data to
disk/application
162320 PID:23effa3e TID:23e30fc6 Size 0
Where size is a global variable.
Would you please let me know correct usage?
Thanks,
Sonia.
P.S this is in the WinCE environment - if that makes any difference.
Received on 2006-08-25