curl-library
Re: reagrding error in getting complete server response
Date: Mon, 18 Nov 2013 11:23:29 +0900
Hi All,
As discussed with Dan and Fahad, i checked the output..but i could see that
the "chunk.memory" ( as per the sample shown in the link
http://curl.haxx.se/libcurl/c/getinmemory.html_) is not getting truncated
exactly at a occurance of binary 0.
In my example...after getting the response this is what i am doing.
char * buffer;
if(res != CURLE_OK)
{
__android_log_print(ANDROID_LOG_DEBUG, "LOG_TAG", "curl_easy_perform()
failed: %s\n", curl_easy_strerror(res));
return (*env)->NewStringUTF(env,curl_easy_strerror(res));
}else
{
__android_log_print(ANDROID_LOG_DEBUG, "LOG_TAG", "\n OUTPUT:content
length(%d)======\n", strlen(page.data));
__android_log_print(ANDROID_LOG_DEBUG, "LOG_TAG", "\n OUTPUT:page
size(%d)======\n", page.len);
__android_log_print(ANDROID_LOG_DEBUG, "LOG_TAG", "\n OUTPUT:%s ======\n",
page.data);
buffer = (char *)malloc(2 * strlen(page.data));
sprintf(buffer, "%ld:%s \n",response_code, page.data);
}
(*env)->ReleaseStringUTFChars(env, webpageJStr, webpage);
curl_easy_cleanup(curl);
if(page.data){
free(page.data);
}
return (*env)->NewStringUTF(env,buffer);
Kindly let me know if i am doing something wrong here?
2. this is the curl response for the content headers
curl -I http://33.33.33/sample.pl <http://33.33.0.33/sample.pl>
HTTP/1.1 200 OK
Date: Thu, 14 Nov 2013 04:40:46 GMT
Server: Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
Content-Type: text/plain; charset=utf-8
i cannot find a content length header here.
3. >>> write some code to walk the whole response and print it character
by charactor,
and stops at Content-Length
can you help me more how to do this in the given example.
regards
Sunil C
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-18