curl-library
Re: reagrding error in getting complete server response
Date: Tue, 12 Nov 2013 11:33:37 +0900
Hi All,
As pointed out, This is the android custom log . I am prinintg the log to
see the response data.
From what i see the orginal output and the current output, i can find that
there are still around 10 to 15 more lines to be prinited, when using CURL
implementation.
Hence as you said i could make out that the response is longer than the
buffer length and so it is getting truncated.
Currently i tried to hardcord the buffer length as
* int* memorysize = 4096;
buffer = (*char* *)malloc(memorysize);
But even when i try to increase the buffer length , it jsut print the same
number of lines. there is no change in the output even if i increase the
buffer length manually.
I reffered to this blog link when i wrote my curltest 'c' file :
http://thesoftwarerogue.blogspot.kr/2010/05/porting-of-libcurl-to-android-os-using.html
So most of the contents are same from the c file as shown in the blog there.
=======
* typedef* *struct* pageInfo_t {
*char* *data;
*int* len;
} pageInfo_t;
* static* size_t
* HTTPData*(*void* *buffer, size_t size, size_t nmemb, *void* *userData) {
*int* len = size * nmemb;
pageInfo_t *page = (pageInfo_t *)userData;
*if* (buffer && page->data && (page->len + len < (16 * 4096)) ) {
memcpy(&page->data[page->len], buffer, len);
page->len += len;
}
*return* len;
}
------
* int* memorysize = 9189;
page.data = (*char* *)malloc(16 * memorysize);
page.len = 0;
*if* (page.data)
memset(page.data, 32, 16 * memorysize);
buffer = (*char* *)malloc(memorysize);
-----
* if* (buffer) {
//page.data[page.len] = '\0';
page.data[page.len < memorysize ? page.len : memorysize-1] = '\0';
sprintf(buffer, "%*ld*:%s \n", response_code, page.data);
*return* (*env)->NewStringUTF(env, buffer);
}
These are the main chunk of the c code..the section shows how i declared my
buffer size .
Please help me understand how the response data of my cgi script page can
be completely added into the buffer (not getting truncated in the middle)
On Sat, Oct 26, 2013 at 3:32 AM, G Drukier <gdrukier_at_imageinsightinc.com>wrote:
> On 25 Oct 2013, at 14:16 , Dan Fandrich <dan_at_coneharvesters.com> wrote:
>
> > On 25 Oct 2013, at 3:29 , Sunil Chandrasekharan <sunil.kainat_at_gmail.com>
> wrote:
> >> .....
> >> 10-25 15:53:22.264: XXX(14847): Security.8021x:true
> >> 10-25 15:53:22.264: XXX(14847): Event.AlarmInput:true
> >> 10-25 15:53:22.264: XXX(14847):
> Event.AlarmInput.Notification.HTTP.CGI:true
> >> 10-25 15:53:22.264: XXX(14847):
> >> Event.AlarmInput.Notification.HTTP.CGI.SingleSession:true
> >> 10-25 15:53:22.264: XXX(14847): Event.AlarmInpu
> >>
> >> There are around 10 more lines in the response, but my current log
> shows that
> >> after "Event.AlarmInpu" there is no output.
> >
> > I don't know what this is. Is this some kind of custom logging output?
> Is this
> > the truncated output of the server as received by your program?
>
> This looks like Android logcat output. That it's Java related is also
> suggested by this method definition
>
> On 25 Oct 2013, at 3:29 , Sunil Chandrasekharan <sunil.kainat_at_gmail.com>
> wrote:
>
> > jstring Java_com_example_JNIGetWebpage( JNIEnv* env,jobject
> entryObject,jstring webpageJStr,jstring host, jint port ,jstring userid,
> jstring pass,jint timeout)
> >
>
> More detail on what the original poster is up to would likely be helpful.
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-11-12