RE: HTTPParser
"Akritidis Xristoforos" <[email protected]> Wed, 17 Sep 2003 13:46:48 +0300
| Newsgroups | gmane.comp.lib.libwww |
|---|---|
| Message-ID | <[email protected]> |
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: [email protected] [mailto:[email protected]] On Behalf Of > Bikram Mishra > Sent: Wednesday, September 17, 2003 12:42 PM > To: Akritidis Xristoforos; [email protected] > 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:[email protected]] > Sent: Wednesday, September 17, 2003 13:18 > To: Bikram Mishra; [email protected] > 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: [email protected] [mailto:[email protected]] On Behalf > Of > > Bikram Mishra > > Sent: Wednesday, September 17, 2003 9:16 AM > > To: [email protected] > > 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