W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1996

Re: libwww AND NT, getting a html-doc into memory-buffer

From: Martin Ostrowski <mostrowski@marlowe.iosys.de>
Date: Wed, 23 Oct 1996 22:30:29 -0000
Message-Id: <01BBC131.CCB3BBF0@MATAHARI>
To: "'frystyk@w3.org'" <frystyk@w3.org>
Cc: "'www-lib@w3.org'" <www-lib@w3.org>
YEAHHH !!!
now it works fine with NT 4.0 WS and libwww 5.0a !

here is the modified code:


#include "WWWLib.h"
#include "WWWHTTP.h"
#include "WWWInit.h"

int main (int argc, char ** argv)
{
    HTRequest * request = HTRequest_new();
    HTChunk * chunk = NULL;
    char * url = argc==2 ? argv[1] : NULL;

    /* Initialize libwww core */
    HTProfile_newPreemptiveClient("TestApp", "1.0");

    /* Turn on TRACE so we can see what is going on */
#if 0
    WWWTRACE = SHOW_CORE_TRACE + SHOW_STREAM_TRACE + SHOW_PROTOCOL_TRACE;
#endif
    HTEventInit();  <-  (don't forget the wsastartup() !)
    /* Set up the request and pass it to the Library */
    HTRequest_setOutputFormat(request, WWW_SOURCE);
    if (url) {
	char * cwd = HTGetCurrentDirectoryURL();
	char * absolute_url = HTParse(url, cwd, PARSE_ALL);
	chunk = HTLoadToChunk(absolute_url, request);
	HT_FREE(absolute_url);
	HT_FREE(cwd);

	/* If chunk != NULL then we have the data */
	if (chunk) {
	    char * string = HTChunk_toCString(chunk);
	    printf("%s", string ? string : "no text");
	    HT_FREE(string);
	}
    } else {
	printf("Type the URL you want to accces on the command line\n");
    }

    /* Clean up the request */
    HTRequest_delete(request);

    /* Terminate the Library */
    HTProfile_delete();
    return 0;
}


Many Thanks to Henrik Frystyk Nielsen, Adam R.B. Jack and John Baker !


Martin Ostrowski


----------------------------------------------------------------------------------------------------------------
ioSYS interactive Object Systems GmbH, Essen

Im Bonsiepen 6
45136 Essen                                   www.kolibri.de
Germany                                         www.iosys.de
                                                     
Received on Wednesday, 23 October 1996 16:19:11 GMT

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