From: Martin Mares Date: Fri, 20 Jun 2003 12:08:39 +0000 (+0000) Subject: Added content-type to HTTP dump. X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ba88711ac603ab3c2a7bca470659e25d60eef9f5;p=netgrind.git Added content-type to HTTP dump. --- diff --git a/netgrind/http.c b/netgrind/http.c index b90c893..b329170 100644 --- a/netgrind/http.c +++ b/netgrind/http.c @@ -189,17 +189,21 @@ static void http_report(struct flow *f, struct http_state *s, u64 when, byte *re 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++; }