Re: Fwd: libwww bug with "HTTP 1.0 keep-alive"

Wendell Hicken wrote:

>         Here's more info on the bug I'm hitting.  I tried to send this to the
> mailing list, but got an "Out of Office AutoReply", so I decided to send
> you a copy directly as well.  Sorry if it comes off as spam.   The test
> program is also considerably smaller.

Modulo a few adjustments, it seems to work from here without any memory
problems - can I get you to try this variant that I have included below?

Henrik
#include "WWWLib.h"
#include "WWWApp.h"
#include "WWWInit.h"

char *data[] = {
   "http://www.statefarm.com/sponsors/natgeo.htm", 
   "http://www.statefarm.com/sponsors/images/natgeo.gif"
};

int printer(const char * fmt, va_list pArgs) {
    return vfprintf(stderr, fmt, pArgs);
}

int tracer(const char * fmt, va_list pArgs) {
    return vfprintf(stderr, fmt, pArgs);
}

int main() {
    unsigned int i;
    HTProfile_newNoCacheClient("Test", "1.0");
    HTPrint_setCallback(printer);
    HTTrace_setCallback(tracer);
    HTSetTraceMessageMask("sop");

    for (i = 0; i < sizeof(data)/sizeof(data[0]); ++i) {
        HTRequest *req = HTRequest_new();
	HTChunk * chunk;
        HTRequest_setPreemptive(req, YES);

	// get is the default method
        // HTRequest_setMethod(req, METHOD_GET);

        HTRequest_setOutputFormat(req, WWW_SOURCE);

	chunk = HTLoadToChunk(data[i], req);
	HTRequest_delete(req);
	if (chunk) HTChunk_delete(chunk);
    }
    HTProfile_delete();
    return 0;
}

Received on Tuesday, 22 June 1999 15:34:05 UTC