I have a text file which represents a http flow like this:
HTTP/1.1 200 OK
Date: Fri, 23 Jan 2009 17:16:24 GMT
Server: Apache
Last-Modified: Fri, 23 Jan 2009 17:08:03 GMT
Accept-Ranges: bytes
Cache-Control: max-age=540
Expires: Fri, 23 Jan 2009 17:21:31 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Age: 233
Content-Length: 1276
Keep-Alive: timeout=1, max=198
Connection: Keep-Alive
Content-Type: application/x-javascript
.4..5...5...>...>.m.....>.Y..?...i...W....X.....&..3}..C}0...3kt.{.k.l....@..........=`...=...e
.g.w.{i.a.,~...Gy..[..s...Bo=.An.$.........m..6j..j....
Dy..Z..:a...m.....qQ...Y&F.Q..*.`<3.uO<....2.3hA.PG4.}:*o..2.z..T..PL<QUX....j........b.%.2.....].v..Nq..iK..S..d..q....9w<.\...............p.9w.v."~......#.'...M.Ju.........n...z.H%Ae..a...[R...rX....k.:.EM..j.W.Z\5..K.v....!n.)..K..JQVT0..X?{v..Bm.......rN?.>>....0..s....*.+....Q.^.#..g.^G.I........;.a..fq......^....S..?g.k[^JE...9+.....HTTP/1.1 200 OK
Date: Fri, 23 Jan 2009 17:16:24 GMT
Server: Apache
Last-Modified: Thu, 18 Sep 2008 09:38:18 GMT
Accept-Ranges: bytes
Content-Length: 1903
Cache-Control: max-age=604800
Expires: Fri, 30 Jan 2009 17:08:23 GMT
Age: 481
Keep-Alive: timeout=1, max=197
Connection: Keep-Alive
Content-Type: image/jpeg
......JFIF.....x.x.....C..............
I need to count characters (bytes) in packet payloads. I noticed that if a packet has a payload this is after a blank line following the headers. It is possible that a new header is attached to a preceding packet as shown in the example. I need an output like this:
pkt1 payload size
pkt2 payload size
....... ........
pktn payload size
Thanks in advance