format_timestamp(stamp, s->req_start_time);
u64 ttotal = when - s->req_start_time;
u64 tresp = (s->resp_line ? (s->resp_start_time - s->req_start_time) : 0);
+ byte *ctype = (http_lookup_hdr(&s->resp_headers, "Content-type:") ? : http_lookup_hdr(&s->req_headers, "Content-type:")) ? : (byte*)"-";
+ byte *sep;
+ if (sep = strchr(ctype, ';'))
+ *sep = 0;
if (!http_counter++)
- printf("# timestamp source destination forwarded-for res cac que length total time wait time method URL\n");
- /* 2003-06-06 22:53:38.642 81.27.194.19:1175 205.217.153.53:80 123.123.123.123 200 ... 0 14030 0.957 0.444 GET http://... */
- printf("%s %-21s %-21s %-15s %-3s %c%c%c %3d %8d %6d.%03d %6d.%03d %s %s\n",
+ printf("# timestamp source destination forwarded-for res cac que length total time wait time ctype method URL\n");
+ /* 2003-06-06 22:53:38.642 81.27.194.19:1175 205.217.153.53:80 123.123.123.123 200 ... 0 14030 0.957 0.444 text/plain GET http://... */
+ printf("%s %-21s %-21s %-15s %-3s %c%c%c %3d %8d %6d.%03d %6d.%03d %-12s %s %s\n",
stamp, src, dst, (ffor ? : "-"), reason,
rq_cflag, rp_cflag, rp_hit,
s->req_counter,
s->body_total_size,
(uns)(ttotal/1000000), (uns)(ttotal%1000000)/1000,
(uns)(tresp/1000000), (uns)(tresp%1000000)/1000,
- method, url);
+ ctype, method, url);
s->req_counter++;
}