Chunk and Filters order problem

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 UTC