Do not crash upon corrupted HTTP header.

This addresses the reported assertion by luis thibodeaux.
This commit is contained in:
Aleric Inglewood
2013-01-03 21:06:20 +01:00
parent 17e0c79fe7
commit 639b264d2d
2 changed files with 23 additions and 10 deletions

View File

@@ -308,9 +308,10 @@ LLAtomicU32 Stats::llsd_body_count;
LLAtomicU32 Stats::llsd_body_parse_error;
LLAtomicU32 Stats::raw_body_count;
// Called from BufferedCurlEasyRequest::setStatusAndReason.
// The only allowed values for 'status' are S <= status < S+20, where S={100,200,300,400,500}.
U32 Stats::status2index(U32 status)
{
llassert_always(status >= 100 && status < 600 && (status % 100) < 20); // Max value 519.
return (status - 100) / 100 * 20 + status % 100; // Returns 0..99 (for status 100..519).
}