|
|
@ -428,25 +428,26 @@ static inline void change_window_size(const PWINDIVERT_TCPHDR ppTcpHdr, unsigned |
|
|
|
/* HTTP method end without trailing space */ |
|
|
|
static PVOID find_http_method_end(const char *pkt, unsigned int http_frag, int *is_fragmented) { |
|
|
|
unsigned int i; |
|
|
|
unsigned int pkt_length = strlen(pkt); |
|
|
|
for (i = 0; i<(sizeof(http_methods) / sizeof(*http_methods)); i++) { |
|
|
|
unsigned int method_length = strlen(http_methods[i]); |
|
|
|
if (memcmp(pkt, http_methods[i], method_length) == 0) { |
|
|
|
if (strncasecmp(pkt, http_methods[i], method_length) == 0) { |
|
|
|
if (is_fragmented) |
|
|
|
*is_fragmented = 0; |
|
|
|
if (method_length - 1 <= pkt_length) |
|
|
|
return (char*)pkt + method_length - 1; |
|
|
|
char *end = strchr(pkt + method_length, ' '); |
|
|
|
if (end != NULL && end - pkt <= pkt_length) |
|
|
|
return end; |
|
|
|
} |
|
|
|
/* Try to find HTTP method in a second part of fragmented packet */ |
|
|
|
if ((http_frag == 1 || http_frag == 2) && |
|
|
|
memcmp(pkt, http_methods[i] + http_frag, |
|
|
|
method_length - http_frag) == 0 |
|
|
|
strncasecmp(pkt, http_methods[i] + http_frag, |
|
|
|
method_length - http_frag) == 0 |
|
|
|
) |
|
|
|
{ |
|
|
|
if (is_fragmented) |
|
|
|
*is_fragmented = 1; |
|
|
|
if (method_length - http_frag - 1 <= pkt_length) |
|
|
|
return (char*)pkt + method_length - http_frag - 1; |
|
|
|
char *end = strchr(pkt + method_length - http_frag, ' '); |
|
|
|
if (end != NULL && end - pkt <= pkt_length) |
|
|
|
return end; |
|
|
|
} |
|
|
|
} |
|
|
|
return NULL; |
|
|
|