libwww Ver 4.0C - When to Remove HTRequest Object?

When can I remove the HTRequest object which is created by HTRequest_dupInternal()?

as in the function below:

------- begin code snipped from HTTPServ.c -----------

PRIVATE int ParseRequest (HTStream * me)
{
    HTRequest * request = me->request;

==>    HTRequest * newreq = me->http->serve = HTRequest_dupInternal(request);

    char * line = HTChunk_data(me->buffer);
    char * method;
    char * request_uri;

    /* Bind the two request objects together */
    newreq->source = request;
    request->output_format = WWW_SOURCE;
    request->source = request;			 	  /* Point to myself */
    HTRequest_addDestination(request, newreq);
    newreq->input_format = WWW_SOURCE;

    /* Handle method and URI */
    if ((method = HTNextField(&line)) && (request_uri = HTNextField(&line))) {
	if ((newreq->method = HTMethod_enum(method)) == METHOD_INVALID) {
	    HTRequest_addError(newreq, ERR_FATAL, NO, HTERR_NOT_ALLOWED,
			       NULL, 0, "ParseRequest");
	    HTRequest_delete(newreq);
	    return HT_ERROR;
	}

	{
	    char * uri = HTParse(request_uri, "file:", PARSE_ALL);
	    newreq->anchor = (HTParentAnchor *) HTAnchor_findAddress(uri);
#if 0
	    /* Take copy of the original uri */
	    StrAllocCopy(newreq->request_uri, request_uri);
#endif
	}
    } else {
	HTRequest_addError(newreq, ERR_FATAL, NO, HTERR_BAD_REQUEST,
			   NULL, 0, "ParseRequest");
	return HT_ERROR;
    }

    /*
    ** Handle version. If we have a 1.x request then always parse headers.
    ** We might find a persistent connection request in which case we don't
    ** want to loose it.
    */
    me->transparent = YES;
    if ((me->version = HTNextField(&line))) {
	request->input_stream =
	    HTTPResponse_new(newreq, HTBufWriter_new(newreq->net, YES, 512));
	newreq->output_stream = request->input_stream;
	me->target = HTStreamStack(WWW_MIME, newreq->output_format,
				   newreq->output_stream, newreq, NO);
	return HT_OK;
    } else {
	if (PROT_TRACE) TTYPrint(TDEST, "Request Line is formatted as 0.9\n");
	request->input_stream = HTBufWriter_new(request->net, YES, 512);
	newreq->output_stream = request->input_stream;
	return HT_LOADED;
    }
}

------- end code snipped from HTTPServ.c -----------

Isn't it supposedly to be removed by the library?

TIA,

Vu Nguyen

Received on Tuesday, 30 January 1996 14:41:54 UTC