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
This commit is contained in:
Evan Huus 2013-05-24 02:31:26 +00:00
parent 4caa94335d
commit ba77e3c54d
1 changed files with 23 additions and 0 deletions

View File

@ -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:
*/