W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2003

RE: HTTPParser

From: Akritidis Xristoforos <cakrit@hol.net>
Date: Wed, 17 Sep 2003 10:47:34 +0300
Message-ID: <AD28A1C5CFD29E448CE44D3E8ECD197402DED018@mail.hol.net>
To: "Bikram Mishra" <bikram@avontechnologies.com>, <www-lib@w3.org>

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 03:47:57 GMT

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