W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

Chunk and Filters order problem

From: Manuele Kirsch Pinheiro <Manuele.Kirsch_Pinheiro@inrialpes.fr>
Date: Tue, 22 Jan 2002 18:38:34 +0100
Message-ID: <3C4DA39A.3070303@inrialpes.fr>
To: www-lib@w3.org
Hi Everybody,  

I have a strange problem using libwww.. I'm trying to download an URL to 
a chunk, but sometimes the "local after" filters have been called before 
I set the chunk to the request's context. So, when I try to use the 
chunk in the filters, it is not available. Here some codes :

Initiate libwww  :
    HTProfile_newNoCacheClient(APP_NAME, APP_VERSION);

Request building :  
    HTRequest * request = HTRequest_new();
    HTRequest_setOutputFormat(request, HTAtom_for ("text/xml"));
    HTRequest_setMethod (request,METHOD_GET);
    HTRequest_addAfter (request, local_request_terminater, NULL, app, 
HT_ALL ,HT_FILTER_LAST , NO);

Executing the request :
   if ( (chunk = HTLoadAnchorToChunk (app->anchor,request)) != NULL) {
        HTPrint ("Loaded\n");
        HTRequest_setContext(request,chunk);
    }
    else
        HTPrint ("MY_DEBUG: load to chunk failed\n");
  
After filter :
   chunk = (HTChunk *) HTRequest_context(request);   
    if ( chunk && HTChunk_data(chunk))
       HTPrint ("Loaded: \n%s\n",HTChunk_data(chunk));
    else
       HTPrint ("No data available\n");

Output :
Sometimes I have the output "No data available" before the "Loaded"....


Has somebody any suggestion? Ah, I can't use a preemptive client, 
neither global filters...

Thanks all!

Manuele

 












   
Received on Tuesday, 22 January 2002 12:34:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT