Closed h3xstream closed 9 years ago
respBody
was changed.The response content used to be converted to string and then substring. bodyOffset
is referring to bytes offset. A string contains char instead of bytes. (A char can contain multiple bytes)
For this reason if the headers contain extended unicode characters*, the substring operation would skip some of the first byte of the body. Also, their is potential OutOfBoundException for empty response body.
* In theory, only ASCII (ISO/IEC 8859-1) characters should be used.. But their could be a confusion during the String creation that form a Unicode character. Also the body could be using a different encoding..
I have push the actual rule implementation 48f98b238101142f246bcccd1b5fcd24273d21e0
It avoid recompiling the regex on each scan or loop iteration. (Better explanation http://stackoverflow.com/a/1721778)
I upgrade JUnit and added Mockito. Feel free to refuse this change. I can do the test with easymock.
Also : Sorry for the load of changes all at once.
I wanted to add a passive rule. Prior integrating the new rule, I wanted to suggest a modular way to organize the different type of analysis. All the passive analysis were placed in the HTTPMatcher utility class.