bug 745379 - mistake in spdy/2 spec reversed actual priority values r=honzab

This commit is contained in:
Patrick McManus 2012-04-15 13:11:23 -04:00
parent 26c6896858
commit 9d41be7518
2 changed files with 19 additions and 12 deletions

View File

@ -91,10 +91,19 @@ public:
const static PRUint8 kFlag_Data_UNI = 0x02;
const static PRUint8 kFlag_Data_ZLIB = 0x02;
const static PRUint8 kPri00 = 0x00;
const static PRUint8 kPri01 = 0x40;
const static PRUint8 kPri02 = 0x80;
const static PRUint8 kPri03 = 0xC0;
// The protocol document for v2 specifies that the
// highest value (3) is the highest priority, but in
// reality 0 is the highest priority.
//
// Draft 3 notes here https://sites.google.com/a/chromium.org/dev/spdy/spdy-protocol/
// are the best guide to the mistake. Also see
// GetLowestPriority() and GetHighestPriority() in spdy_framer.h of
// chromium source.
const static PRUint8 kPri00 = 0 << 6; // highest
const static PRUint8 kPri01 = 1 << 6;
const static PRUint8 kPri02 = 2 << 6;
const static PRUint8 kPri03 = 3 << 6; // lowest
enum
{

View File

@ -325,8 +325,6 @@ SpdyStream::ParseHttpRequestHeaders(const char *buf,
memset (mTxInlineFrame + 12, 0, 4);
// Priority flags are the C0 mask of byte 16.
// From low to high: 00 40 80 C0
// higher raw priority values are actually less important
//
// The other 6 bits of 16 are unused. Spdy/3 will expand
// priority to 4 bits.
@ -336,13 +334,13 @@ SpdyStream::ParseHttpRequestHeaders(const char *buf,
// receive windows, separate from their spdy priority
//
if (mPriority >= nsISupportsPriority::PRIORITY_LOW)
mTxInlineFrame[16] = SpdySession::kPri00;
else if (mPriority >= nsISupportsPriority::PRIORITY_NORMAL)
mTxInlineFrame[16] = SpdySession::kPri01;
else if (mPriority >= nsISupportsPriority::PRIORITY_HIGH)
mTxInlineFrame[16] = SpdySession::kPri02;
else
mTxInlineFrame[16] = SpdySession::kPri03;
else if (mPriority >= nsISupportsPriority::PRIORITY_NORMAL)
mTxInlineFrame[16] = SpdySession::kPri02;
else if (mPriority >= nsISupportsPriority::PRIORITY_HIGH)
mTxInlineFrame[16] = SpdySession::kPri01;
else
mTxInlineFrame[16] = SpdySession::kPri00;
mTxInlineFrame[17] = 0; /* unused */