W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2001

Getting both a chunk and HText callbacks

From: Joel Young <jdy@godel.cs.brown.edu>
Date: Fri, 25 May 2001 15:30:24 -0400
Message-Id: <200105251930.PAA04639@godel.cs.brown.edu>
To: www-lib@w3.org
cc: jdy@cs.brown.edu

I am trying to use HTTee to get libwww to simultaneously from one
HTLoad to load the webpage into a chunk and also to call my HText
callbacks.  Here is the code I am using:

  HTRequest* request = HTRequest_new();
  HTNet_addAfter(&term_handler, 0, 0, HT_ALL, HT_FILTER_LAST);
  HTHost_setEventTimeout(15000); // if can't load 15 secs, abort

  HTAnchor* anchor = HTAnchor_findAddress(url);
  HTRequest_setAnchor(request, anchor);

  HTChunk* chunkchunk = 0; 
//  HTRequest_setOutputFormat(request,WWW_SOURCE);
  HTStream* chunkstream = HTStreamToChunk(request,&chunkchunk,-1);


  HTStream* target = HTTee(chunkstream, HTRequest_outputStream(request),0);

  HTRequest_setOutputStream(request, target);

  HTLoad(request, NO);


  std::cerr << HTChunk_size(chunkchunk) << std::endl;
  char* strchunk = HTChunk_toCString(chunkchunk);
  std::cerr << strchunk << std::endl;

Depending on if the HTRequest_setOutputFormat line is commented or not I
either get the HText callbacks or I get the chunk, but I can't seem to
get both.

Any suggestions?

Received on Friday, 25 May 2001 15:30:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:54 UTC