0

I am trying to parse a file containing multiple header and data so that header part

HTTP/1.1 302 Found
Cache-Control: no-store, no-cache, private
Pragma: no-cache
Expires: Sat, 15 Nov 2008 16:00:00 GMT
P3P: policyref="http://cdn.adnxs.com/w3c/policy/p3p.xml", CP="NOI DSP COR ADM PSAo PSDo OURo SAMo UNRo OTRo BUS COM NAV DEM STA PRE"
X-XSS-Protection: 0
Location: http://ib.adnxs.com/tt?id=868557&size=728x90&referrer=facebook.com
Date: Thu, 31 Jan 2013 05:49:01 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

can be written into a separate file(.header) and the content after this header information can be stored in a data file(.data).

But problem comes when some header part contains ETag field and the header where only ETag is written in place on HTTP.

What should be the logic so that it can be parsed??

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Rajeev Das
  • 1,581
  • 4
  • 18
  • 21
  • ETag: "2790fa9a82fdcd1:0" Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Age: 2498 Date: Thu, 31 Jan 2013 05:49:01 GMT Last-Modified: Mon, 28 Jan 2013 18:09:25 GMT Content-Length: 2432 Connection: keep-alive – Rajeev Das May 02 '13 at 09:37
  • HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=60,stale-while Content-Length: 44 Content-Type: image/gif Date: Thu, 31 Jan 2013 05:48:31 GMT Etag: "YM:1:f5c25396-26ac-4e57-a715-66f32aa0289b0004cee17fc45c58" Expires: Thu, 31 Jan 2013 05:49:31 GMT Last-Modified: Mon, 19 Nov 2012 23:30:13 GMT Server: ATS/3.2.0 Via: HTTP/1.1 web1.use5.mobstor.ac4.yahoo.com YahooTrafficServer/3.0.1 (UFF), http/1.0 l1.ycs.dxs.yahoo.com (ApacheTrafficServer/3.2.0) x-ysws-request-id: 59942e6b-4ee2-ac59-d575368bcec9 x-ysws-visited-replicas: gops.use5.mobstor.vip.ac4.yahoo.com Age: 31 Connection: keep-alive – Rajeev Das May 02 '13 at 09:40
  • I don't understand the statement "But problem comes when some header part contains ETag field and the header where only ETag is written in place on HTTP." -- give an example and state what the problem is. – Julian Reschke May 02 '13 at 12:45
  • I have a file in which content is available in this fashion:- HTTP 302 Found.......content type,content length>>>>then after \n\r\n\r>>>>data of a .pdf of jpeg file written in text>>>>ETag: "2790fa9a82fdcd1:0" .........content type,content length>>>>then after \n\r\n\r>>>>>>some data like .pdf or .jpeg file written in text>>>>>In the next step,itcan be HTTP or ETag.But in some cases "HTTP......ETag:.."2790fa9a82fdcd1:0"..Content type,content length" contains ETag also – Rajeev Das May 03 '13 at 11:45
  • I honestly have no idea what you're talking about. Can you post a sample URI? – Julian Reschke May 03 '13 at 13:58

0 Answers0