Error in Get Request

hi,
i am developing proxy server application using libwww.
My application stands in between Browser 

and Remote server. My application receives request
from the browser and passes it to the remote 

server and receives data from remore server and passes
to client (i.e.browser) 
The following function i have written for GET request.
In GET request, http request is broken as 

several requests.For the first part request is going
to remote server and getting response 

properly. In second request it is going infinite loop.

i tried to debug the application, this returning from
the function AsyncWindowProc() of 

HTEvtList.c from the following code
 /* timeout stuff */
if (uMsg == WM_TIMER) 
{	HTTimer_dispatch((HTTimer *)wParam);
	return (0);
}

unable to understand why this function is getting
returned.

anybody helps will be greatly appreciated  

void requesttoISP()
{
	char *url;
	HTRequest * request = HTRequest_new();
	HTChunk * chunk = NULL;
	HTAnchor * anchor = NULL;
      	char *uri=NULL;
	char buf[255];

	    
	/* traceURL() function returns URL from http request
	if (strcmp((url= traceURL()),"NT") == 0) 
		printf("Error in Tracing URL\n ");


    /* Initialize libwww core */
    HTProfile_newNoCacheClient("libwww-GET", "1.0");
   
	HTEventInit();
   /* Gotta set up our own traces */
    HTPrint_setCallback(printer);
    HTTrace_setCallback(tracer);
	
    HTCookie_init();
    HTCookie_setCallbacks(setCookie, NULL, findCookie,
NULL);
   HTCookie_setCookieMode(HT_COOKIE_ACCEPT);

    /* Turn on TRACE so we can see what is going on */
#if 0
    HTSetTraceMessageMask("sop");

#endif

    /* We want raw output including headers */
   	HTRequest_setOutputFormat(request, WWW_RAW);
    
	/* Close connection immediately */
	HTRequest_addConnection(request, "close", "");

    /* Add our own filter to handle termination */
    HTNet_addAfter(terminate_handler, NULL, NULL,
HT_ALL, HT_FILTER_LAST);
	HTHost_setEventTimeout(10000);

	/* Get an anchor object for the URI */
	anchor = HTAnchor_findAddress(url);
	
	/* My own function for parsing the request and
storing input data values in the params*/
	HTTPRequestParser(&oldmessage,&req); 
	printf("\n Parsed Request: %s", req.method);
	Params *tempparam=&req.uri.params;

	int paramcount=0;
    
	if (tempparam->param_name != NULL)
	{
		while(tempparam->nextparam!=NULL)
			{
			sprintf(buf,"%s =
%s",tempparam->param_name,tempparam->param_value);
			 /* Create a list to hold the form arguments */
			formfields = HTAssocList_new();
			HTParseFormInput(formfields, buf);
								
			tempparam=tempparam->nextparam;
			if (tempparam->nextparam==NULL)
			{
						
			sprintf(buf,"%s =
%s",tempparam->param_name,tempparam->param_value);
			 /* Create a list to hold the form arguments */
			formfields = HTAssocList_new();
			HTParseFormInput(formfields, buf);
			}
			paramcount++;
		}// end of while
	
			
		if (paramcount >0)
		{
		bool b = HTGetFormAnchor (formfields,(HTAnchor
*)anchor,request);
		/* Clean up the form fields */
		HTAssocList_delete(formfields);
		}
	
	
		
	}//if 
	chunk = HTLoadAnchorToChunk (anchor, request);

	/* If chunk != NULL then we have the data */
	
	if (chunk)
		{
	     
	    /* Go into the event loop... */
	      HTEventList_loop(request);
	
		/* sending chunk data to socket */	  
	   	res = send(newSd,chunk->data,chunk->allocated,0);
		res1 = WSAGetLastError ();

		printf("\n in chunk data length is : %d",
chunk->allocated);
		printf("\n send resulted  : %d : %d", res, res1);

		closesocket(newSd);
		
		} //if chunk
	
	  else
		{
			HTPrint("Type the URL you want to accces on the
command line\n");
		}

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

	url = NULL;//new
	HTChunk_clear(chunk);//new
	HTAnchor_delete	(HTAnchor_parent(anchor));
	HTChunk_delete(chunk);//new
    /* Terminate the Library */
    //HTProfile_delete(); 

	
	}

thanks & regards,
venu


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Received on Friday, 9 May 2003 03:00:07 UTC