[Prev][Next][Index][Thread]

Question about use of libwww 4 prerelease



I have written the appended program to test some simple things in the
prerelease. The following code just dumps the hardcoded URL to a file, but
this file includes the HTTP headers which I don't want there. That is
indeed excatly what the documentation states it should do, but what should
I do in order to exclude them ? I've been trying to use
HTConversion_add/HTFormat_setConversion, in order to use some of the other
format conversions, with no success. My knowledge about library internals
are a little to diffuse for me to write my own format converter, so any
help would be appreciated.

	Gunnar	

#include <stdio.h>
#include "WWWLib.h"
#include "HTHome.h"
#include "HTTP.h"

main()
{
  char *url="http://www.oslonett.no/~candle/demos/awelogo.awe";
  FILE *fp;
  PRIVATE HTRequest * request;
  PRIVATE HTList *	c = NULL;
  c = HTList_new();
  HTLibInit("CandleWeb", "beta pl5");
  HTProtocol_add("http", YES, HTLoadHTTP);   
  HTNetCall_addBefore(HTLoadStart, 0);
  HTNetCall_addAfter(HTLoadTerminate, HT_ALL);
   if( (fp = fopen("foo", "w")) == NULL){
     return 0;
   }
  request =  HTRequest_new(); 

  HTRequest_setMethod(request, METHOD_GET);
 
  HTRequest_setOutputStream(request,HTFWriter_new(fp, NO));

  HTRequest_setOutputFormat(request, WWW_SOURCE);
  HTRequest_setPreemtive (request, 1);

  printf("Loading URL %s\n", url);

  HTLoadAbsolute(url, request);
}