| Index: net/spdy/spdy_framer.cc
|
| diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
|
| index 970899da2694eef4e957a0aa43f5a5907bf57c6c..23080accd994ad2c6982d3e639fdaab2a1c28981 100644
|
| --- a/net/spdy/spdy_framer.cc
|
| +++ b/net/spdy/spdy_framer.cc
|
| @@ -90,7 +90,7 @@ SettingsFlagsAndId SettingsFlagsAndId::FromWireFormat(int version,
|
|
|
| SettingsFlagsAndId::SettingsFlagsAndId(uint8 flags, uint32 id)
|
| : flags_(flags), id_(id & 0x00ffffff) {
|
| - LOG_IF(DFATAL, id > (1u << 24)) << "SPDY setting ID too large.";
|
| + LOG_IF(DFATAL, id > (1u << 24)) << "SPDY setting ID too large: " << id;
|
| }
|
|
|
| uint32 SettingsFlagsAndId::GetWireFormat(int version) const {
|
| @@ -1607,6 +1607,7 @@ void SpdyFramer::DeliverHpackBlockAsSpdy3Block() {
|
| }
|
|
|
| bool SpdyFramer::ProcessSetting(const char* data) {
|
| + int id_field;
|
| SpdySettingsIds id;
|
| uint8 flags = 0;
|
| uint32 value;
|
| @@ -1617,33 +1618,24 @@ bool SpdyFramer::ProcessSetting(const char* data) {
|
| const uint32 id_and_flags_wire = *(reinterpret_cast<const uint32*>(data));
|
| SettingsFlagsAndId id_and_flags =
|
| SettingsFlagsAndId::FromWireFormat(protocol_version(), id_and_flags_wire);
|
| - id = static_cast<SpdySettingsIds>(id_and_flags.id());
|
| + id_field = id_and_flags.id();
|
| flags = id_and_flags.flags();
|
| value = ntohl(*(reinterpret_cast<const uint32*>(data + 4)));
|
| } else {
|
| - id = static_cast<SpdySettingsIds>(*(reinterpret_cast<const uint8*>(data)));
|
| + id_field = *(reinterpret_cast<const uint8*>(data));
|
| value = ntohl(*(reinterpret_cast<const uint32*>(data + 1)));
|
| }
|
|
|
| // Validate id.
|
| - switch (id) {
|
| - case SETTINGS_UPLOAD_BANDWIDTH:
|
| - case SETTINGS_DOWNLOAD_BANDWIDTH:
|
| - case SETTINGS_ROUND_TRIP_TIME:
|
| - case SETTINGS_MAX_CONCURRENT_STREAMS:
|
| - case SETTINGS_CURRENT_CWND:
|
| - case SETTINGS_DOWNLOAD_RETRANS_RATE:
|
| - case SETTINGS_INITIAL_WINDOW_SIZE:
|
| - // Valid values.
|
| - break;
|
| - default:
|
| - DLOG(WARNING) << "Unknown SETTINGS ID: " << id;
|
| - return false;
|
| + if (!SpdyConstants::IsValidSettingId(protocol_version(), id_field)) {
|
| + DLOG(WARNING) << "Unknown SETTINGS ID: " << id_field;
|
| + return false;
|
| }
|
| + id = SpdyConstants::ParseSettingId(protocol_version(), id_field);
|
|
|
| if (protocol_version() <= SPDY3) {
|
| // Detect duplicates.
|
| - if (static_cast<uint32>(id) <= settings_scratch_.last_setting_id) {
|
| + if (id <= settings_scratch_.last_setting_id) {
|
| DLOG(WARNING) << "Duplicate entry or invalid ordering for id " << id
|
| << " in " << display_protocol_ << " SETTINGS frame "
|
| << "(last setting id was "
|
| @@ -2294,11 +2286,14 @@ SpdySerializedFrame* SpdyFramer::SerializeSettings(
|
| if (it->second.persisted) {
|
| setting_flags |= SETTINGS_FLAG_PERSISTED;
|
| }
|
| - SettingsFlagsAndId flags_and_id(setting_flags, it->first);
|
| + SettingsFlagsAndId flags_and_id(
|
| + setting_flags,
|
| + SpdyConstants::SerializeSettingId(protocol_version(), it->first));
|
| uint32 id_and_flags_wire = flags_and_id.GetWireFormat(protocol_version());
|
| builder.WriteBytes(&id_and_flags_wire, 4);
|
| } else {
|
| - builder.WriteUInt8(static_cast<uint8>(it->first));
|
| + builder.WriteUInt8(SpdyConstants::SerializeSettingId(protocol_version(),
|
| + it->first));
|
| }
|
| builder.WriteUInt32(it->second.value);
|
| }
|
|
|