On 23/07/2015 10:41 a.m., Alex Rousskov wrote: > Hello, > > The attached patch adds SBuf and Tokenizer methods to simplify > suffix parsing and skipping (and to make suffix/reverse APIs more > similar to prefix/forward ones). The new methods are used in another > patch (to be posted shortly) that makes the request line parser simpler > and more robust, but they are useful in other contexts as well IMO. > > For consistency sake, I tried to mimic the existing Tokenizer/SBuf > documentation, debugging, and code duplication styles. > > > One old problem was detected and documented during this project: The > Tokenizer::parsedSize() method does not account for the successfully > parsed and removed suffix/trailing characters in most cases. That method > should be revised or removed. Solving this problem is outside this > project scope. > > > This and the following patch are based on trunk r14083. I will update to > the current trunk if the patches are approved. Please let me know if you > want to review the updated versions as well.
in SBuf.h: * SBuf::findLastNotOf() documentation looks wrong. - s/occurrences before/occurrences after/ - it scans from buf[endPos] to buf[0]. And the other 'findLast' method had before/after change in the comments. * not sure why the "TODO: rename to camelCase" still existed. - probably should not be copied to the new method(s) anyhow. * consumeTrailling() does not account for bytes in parsed_ like consume(). - parsed_ is about *total pared bytes*. direction is irrelevant. - the paths where consumeTrailing() is called with n==length() *will* account for parsed_, the others do not. This is a new bug. - 3 of 4 uses are new code added in this patch, hitting that new bug. - the 4th case is suffix() where you already fixed the old bug of suffix not using a consumeTrailing() helper method to do its buffer consume. Still at -0. Please do fix the above. Amos _______________________________________________ squid-dev mailing list [email protected] http://lists.squid-cache.org/listinfo/squid-dev
