RE: HTTPParser

Thanks Chris.
But here we have to put the request using libwww API's and also for
response.
But I requirement is I will get the response without using the libwww
and then will use the libwww to parse the header.
Can it be possible?
Thanks,
Bikram 

-----Original Message-----
From: Akritidis Xristoforos [mailto:cakrit@hol.net]
Sent: Wednesday, September 17, 2003 13:18
To: Bikram Mishra; www-lib@w3.org
Subject: RE: HTTPParser



This should do it for you.
Check out my email (a better wwwlib example) for context, if you like

Chris

	HTAssocList * headers = HTResponse_header(response);
	if (headers) {
	  HTAssoc * pres;
	  (*HTMLheader) = (char *) malloc (sizeof(char) * 1024);
	  (*HTMLheader)[0] = '\0';
	  while ((pres = (HTAssoc *) HTAssocList_nextObject(headers))) {
	    char * name = HTAssoc_name(pres);
	    char * value = HTAssoc_value(pres);
	    if (strcmp(name,"status") == 0) {
	      RETURNVALUE = atoi(value);
	    } else {
	      debug(D_DEBUG,"HEADER %s = %s", name, value);
	      sprintf(*HTMLheader,"%s%s = %s\n",*HTMLheader,name,value);
	    }
	  }
	}

> -----Original Message-----
> From: www-lib-request@w3.org [mailto:www-lib-request@w3.org] On Behalf
Of
> Bikram Mishra
> Sent: Wednesday, September 17, 2003 9:16 AM
> To: www-lib@w3.org
> Subject: HTTPParser
> 
> 
> I have a requirement of parsing the Response Header.
> Can anyone please tell me which package to use and which function?
> I don't want write any parser.
> I will call that function from the libwww and will pass the data
> whatever I will receive as response.
> And the function of libwww should return me the header only.
> And also I may pass the which header field is required and the value
of
> it should be returned by the function.
> I have gone through the MIME Parser, but I didn't find any parser
> function.
> What I found out is to write a callback function and that function can
> be added with an API of the MIME Parser.
> 
> Thanks,
> Bikram

Received on Wednesday, 17 September 2003 05:38:12 UTC