[squid-dev] [PATCH] HTTP Response Parser upgrade
Alex Rousskov
rousskov at measurement-factory.com
Fri Jan 23 18:07:45 UTC 2015
On 01/20/2015 06:58 AM, Amos Jeffries wrote:
> Updated patch attached resolving the issues found by coadvisor in the
> original.
> + // HTTP Response status-line parse
> +
> + // magic contains major version, still need to find minor
> + SBuf verMinor;
> + // NP: we limit to 2-digits for speed, there really is no limit
> + // XXX: the protocols we accept dont have valid versions > 10 anyway
> + if (!tok.prefix(verMinor, CharacterSet::DIGIT, 2))
> + return -1; // invalid version minor code
> + if (tok.atEnd())
> + return 0; // need more to be sure we have it all
> + if(!tok.skip(' '))
> + return -1; // invalid version, a single SP terminator required
> +
> + debugs(74, 6, "found string version-minor=" << verMinor);
> +
> + // get the actual numeric value of the 0-3 digits we found
> + ::Parser::Tokenizer t2(verMinor);
> + int64_t tvm = 0;
> + if (!t2.int64(tvm))
> + return -1; // ouch. digits not forming a valid number?
Parsing problems similar to those discussed earlier.
> + int retcode = parseResponseFirstLine();
Make const if possible.
Thank you,
Alex.
More information about the squid-dev
mailing list