cURL / Mailing Lists / curl-library / Single Mail

curl-library

buffer gets lost

From: Marco <marcoigarapava_at_gmail.com>
Date: Fri, 13 Jan 2012 07:16:29 -0200

Hello,

I'm having trouble with the page content retrieved when I use
"curl_easy_perform(curl);", basically, every time I try to get a page
from a localhost, everything goes right, don't matter how big the page is.

But when I try in any remove server, even google, only the very-end of
page (at about 100 bytes) is returned to the buffer variable.

I'm not being able to retrieve not a even a page of 2KB. Does anybody
have an ideia of why this is happening?

-------- Curl buffer writer function --------

int writer(char *data, size_t size, size_t nmemb, string *buffer){
int result = 0;

if(buffer != NULL) {
buffer -> assign(data, size * nmemb);
result = size * nmemb;
}
else {
buffer -> assign("");
}

return result;
}

------ Verbose from a remote server ----------

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Date: Fri, 13 Jan 2012 09:02:02 GMT
< Server: Apache/2.2.8 (CentOS)
< X-Powered-By: PHP/5.2.10
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Cache-Control: must-revalidate, s-maxage=0, max-age=0
< Content-Length: 6220
< Content-Type: text/xml; charset=utf-8
< X-Cache: MISS from sitename.com
< X-Cache-Lookup: MISS from sitename.com:80
< Via: 1.0 sitename.com:80 (squid/2.6.STABLE21)
< Connection: close
<
* Closing connection #0

------ Verbose from localhost ----------

* About to connect() to 127.0.0.1 port 80 (#0)
* Trying 127.0.0.1... * connected
* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> POST /api.php HTTP/1.1
Host: 127.0.0.1
Accept: */*
Content-Length: 67
Content-Type: application/x-www-form-urlencoded

< HTTP/1.1 200 OK
< Date: Fri, 13 Jan 2012 09:02:27 GMT
< Server: Apache/2.2.20 (Ubuntu)
< X-Powered-By: PHP/5.3.6-13ubuntu3.3
< Vary: Accept-Encoding,Cookie
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Expires: Thu, 19 Nov 1981 08:52:00 GM
< Pragma: no-cache
< Content-Length: 3848
< Content-Type: text/xml; charset=utf-8
<
* Connection #0 to host 127.0.0.1 left intact

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-13