UPDATE: The info in this post has been re-addressed here.
So, ReverseDOS 1.0 has a bug in it. I was totally oblivious to it until I was working on the code for ReverseDOS 1.2 and was thinking post filters through again.
Jerome Laban also caught the bug and commented about it in a previous post. And last night I got an email from Joseph Cooney who not only noticed the bug, but sent me an email with the fix. I liked his fix much better than mine, so I'm pinching it.
First of all, what was the problem In reverseDOS 1.0, postfilters (and their regex, and keyed counterparts) scanned the Request.InputStream to gain access to the body of the POST. But, because that's a stream, reading it 'winds' it out to the last byte/position. Subsequent attempts to read, in ReverseDOS 1.0, were then trying to filter against the POST body, and there was nothing to scan. In other words, the bug was my failure to 'rewind' the InputStream back to it's starting postion.
Here was my fix:
long originalPosition = this._request.InputStream.Position; string output; using(StreamReader sr = new StreamReader(this._request.InputStream)) output = sr.ReadToEnd(); // reset the stream for further reads: this._request.InputStream.Position = originalPosition;
Here is Joseph's fix, and the one that will go in to ReverseDOS 1.2:
string output; request.InputStream.Seek(0, SeekOrigin.Begin); using(StreamReader sr = new StreamReader(request.InputStream)) output = sr.ReadToEnd();
As you can see, his fix requires just one line where mine required two, and is still readable (i.e. has good factors), so it's an obvious win in my book.