After filter not run after successful Put

Hi! I have a problem, please help!

I'm trying to do a simple put of data (from memory) to a URL. The problem
is that I (apparently) have to enter the event loop for having the request
processed, but I can't terminate the event loop in the case when the Put
was successful. I try to terminate the loop with an After filter, but it seems
that this filter is never executed after successful Put. On the other hand,
when the Put fails, the filter is executed.

Most of all I would like to never enter the loop - just call a procedure that
simply does the job. Is there one? If not, can someone give me a guess
about what can be wrong? The essential code pieces are given below.

Thanks in advance,
Jerker

int terminator( HTRequest* request, HTResponse* response, void* param, int status ) 
{
  std::cerr << "Now in terminator" << std::endl;
  HTNet_deleteAfter( terminator );
  HTRequest_delete( request );
  HTEventList_stopLoop();

  return HT_OK;
}

int main( void )
{
  // The following 10 lines are placed in another procedure in the real application
  HTList* encodings = HTList_new();
  HTLibInit( "PutApp", "1.0" );
  HTEventInit();
  HTTransportInit();
  HTProtocolInit();
  HTNetInit();
  HTAAInit();
  HTTransferEncoderInit( encodings );
  HTFormat_setTransferCoding( encodings );
  HTMIMEInit();

  HTRequest* request = HTRequest_new();
  HTAnchor* dst = HTAnchor_findAddress( /* URL */ );
  HTParentAnchor* src = HTTmpAnchor( NULL );

  HTAnchor_setDocument( src, /* Data block pointer */ );
  HTAnchor_setFormat( src, WWW_PLAINTEXT );
  HTAnchor_setLength( src, /* Data block size */ );
  HTNet_addAfter( terminator, NULL, NULL, HT_ALL, HT_FILTER_LAST );

  bool status = HTPutAnchor( src, dst, request );
  if( status )
  {
    HTEventList_loop(request);
  }

  // The following 3 lines are placed in another procedure in the real application
  HTFormat_deleteAll();
  HTEventTerminate();
  HTLibTerminate();
}

Received on Thursday, 3 August 2000 08:06:21 UTC