diff options
author | Evan Huus <eapache@gmail.com> | 2013-05-24 02:31:26 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-05-24 02:31:26 +0000 |
commit | ba77e3c54d6aaf5617c76ffbcc2f4a6759b702bb (patch) | |
tree | 9482e67053823ba82b5c22b48e24dd8ffe3b1d97 /epan/req_resp_hdrs.c | |
parent | 4caa94335d5213c59266300ccd16d9331d31e236 (diff) |
Add an optimization to req_resp_hdrs_do_reassembly that shaves about 20% off
the load time of one of my sample captures that is HTTP-but-not-really.
Also add modelines.
svn path=/trunk/; revision=49551
Diffstat (limited to 'epan/req_resp_hdrs.c')
-rw-r--r-- | epan/req_resp_hdrs.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index f6ae0a6303..52592f49cb 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -148,6 +148,16 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, * have already been handled above. */ if (desegment_body) { + /* Optimization to avoid fetching the whole (potentially very long) + * line and doing expensive string comparisons if the first + * character doesn't match. Shaves about 20% off the load time of + * one of my sample files that's HTTP-alike. */ + guchar first_byte = tvb_get_guint8(tvb, next_offset_sav); + if (! (first_byte == 'c' || first_byte == 'C' || + first_byte == 't' || first_byte == 'T')) { + continue; + } + /* * Check if we've found Content-Length. */ @@ -405,3 +415,16 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, */ return TRUE; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |