Did the function HTXML_write forget to write stream to the "target" stream?

View: New views
2 Messages — Rating Filter:   Alert me  

Did the function HTXML_write forget to write stream to the "target" stream?

by broom9 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I'm new to libwww, and have a question about downloading XML with it.
I set up the example program, when I used it to download HTML pages and images, it worked well. But when I switch to XML, it failed to write the file to harddisk. According to the log, the program had got the content of the XML, but didn't write it down.
I traced the program and finally focused to the function HTXML_write(HTStream *me, const char *buf, in len) in HTXML.c
I think this function should write the content to the target stream in the param HTStream "me", after doing the XML_Parse work, just like what it did in function HTXML_abort.
I added a line of code
   (*me->target->isa->put_block)(me->target,buf,len);
before the return of HTXML_write. Then it worked here.
Is this a bug? Or the fault of my programming? Wish someone can help me. Thank you

--
Wei Wei

Re: Did the function HTXML_write forget to write stream to the "target" stream?

by Vic Bancroft-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


wei wei wrote:

>I traced the program and finally focused to the function HTXML_write(HTStream
>*me, const char *buf, in len) in HTXML.c
>  
>
Okay . . .

>I think this function should write the content to the target stream in the
>param HTStream "me", after doing the XML_Parse work, just like what it did
>in function HTXML_abort.
>  
>
Interesting . . .

>I added a line of code
>   (*me->target->isa->put_block)(me->target,buf,len);
>before the return of HTXML_write. Then it worked here.
>  
>
Did you check me->target as well, something like

97a98,99
 >         if(me->target)
 >           (*me->target->isa->put_block)(me->target,buf,len);

more,
l8r,
v

--
"The future is here. It's just not evenly distributed yet."
 -- William Gibson, quoted by Whitfield Diffie