Try to optimize a bit.

svn path=/trunk/; revision=32973
This commit is contained in:
Anders Broman 2010-05-26 11:51:41 +00:00
parent 2ed269439d
commit f19eee998f
1 changed files with 10 additions and 21 deletions

View File

@ -53,6 +53,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
gboolean content_type_found = FALSE; gboolean content_type_found = FALSE;
gboolean chunked_encoding = FALSE; gboolean chunked_encoding = FALSE;
gboolean keepalive_found = FALSE; gboolean keepalive_found = FALSE;
gchar *line;
/* /*
* Do header desegmentation if we've been told to. * Do header desegmentation if we've been told to.
@ -151,24 +152,15 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
/* /*
* Check if we've found Content-Length. * Check if we've found Content-Length.
*/ */
if (tvb_strncaseeql(tvb, next_offset_sav, line = tvb_get_ephemeral_string(tvb, next_offset_sav, linelen);
"Content-Length:", 15) == 0) { if (g_ascii_strncasecmp(line, "Content-Length:", 15) == 0) {
header_val = tvb_get_ephemeral_string(tvb, if (sscanf(line+15,"%li", &content_length) == 1)
next_offset_sav + 15,
linelen - 15);
if (sscanf(header_val,
"%li", &content_length)
== 1)
content_length_found = TRUE; content_length_found = TRUE;
} else if (tvb_strncaseeql(tvb, next_offset_sav, } else if (g_ascii_strncasecmp(line, "Content-Type:", 13) == 0) {
"Content-Type:", 13) == 0) {
content_type_found = TRUE; content_type_found = TRUE;
} else if (tvb_strncaseeql(tvb, next_offset_sav, } else if (g_ascii_strncasecmp(line, "Connection:", 11) == 0) {
"Connection:", 11) == 0) {
/* Check for keep-alive */ /* Check for keep-alive */
header_val = tvb_get_ephemeral_string(tvb, header_val = line+11;
next_offset_sav + 11,
linelen - 11);
if(header_val){ if(header_val){
while(*header_val==' '){ while(*header_val==' '){
header_val++; header_val++;
@ -177,9 +169,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
keepalive_found = TRUE; keepalive_found = TRUE;
} }
} }
} else if (tvb_strncaseeql(tvb, } else if (g_ascii_strncasecmp( line, "Transfer-Encoding:", 18) == 0) {
next_offset_sav,
"Transfer-Encoding:", 18) == 0) {
/* /*
* Find out if this Transfer-Encoding is * Find out if this Transfer-Encoding is
* chunked. It should be, since there * chunked. It should be, since there
@ -189,8 +179,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
gchar *p; gchar *p;
guint len; guint len;
header_val = tvb_get_ephemeral_string(tvb, header_val = line+18;
next_offset_sav + 18, linelen - 18);
p = header_val; p = header_val;
len = (guint) strlen(header_val); len = (guint) strlen(header_val);
/* Skip white space */ /* Skip white space */