RE: HTTPParser

Chris, Thanks for the response. Your guess is right
I want to parse a string which consists of header and body.
Then I want to send it to the client browser which has requested it.
But before that I want to parse the header using libwww.
So response object should be created from the string.
Can anybody give me any idea?
Thanks,
bikram

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


I really don't get what you're trying to accomplish. My guess is that
you want to parse something like a string or a file containing both the
response headers and body, use libwww to pick out the header and then
what? What will you be sending with libwww? A new request using the same
header? 

Whatever the case may be, I believe you can instruct libwww to read the
response from whatever input stream you like, but I don't know how to do
it. 

Chris 

> -----Original Message-----
> From: www-lib-request@w3.org [mailto:www-lib-request@w3.org] On Behalf
Of
> Bikram Mishra
> Sent: Wednesday, September 17, 2003 12:42 PM
> To: Akritidis Xristoforos; www-lib@w3.org
> Subject: 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 07:18:02 UTC