| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/core/quic_headers_stream.h" | 5 #include "net/quic/core/quic_headers_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 bool end_headers) override { | 142 bool end_headers) override { |
| 143 if (end_headers) { | 143 if (end_headers) { |
| 144 if (stream_->IsConnected()) { | 144 if (stream_->IsConnected()) { |
| 145 stream_->OnHeaderList(header_list_); | 145 stream_->OnHeaderList(header_list_); |
| 146 } | 146 } |
| 147 header_list_.Clear(); | 147 header_list_.Clear(); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 | 150 |
| 151 void OnError(SpdyFramer* framer) override { | 151 void OnError(SpdyFramer* framer) override { |
| 152 CloseConnection(base::StringPrintf( | 152 CloseConnection( |
| 153 "SPDY framing error: %s", | 153 QuicStrCat("SPDY framing error: ", |
| 154 SpdyFramer::ErrorCodeToString(framer->error_code()))); | 154 SpdyFramer::ErrorCodeToString(framer->error_code()))); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void OnDataFrameHeader(SpdyStreamId stream_id, | 157 void OnDataFrameHeader(SpdyStreamId stream_id, |
| 158 size_t length, | 158 size_t length, |
| 159 bool fin) override { | 159 bool fin) override { |
| 160 if (stream_->OnDataFrameHeader(stream_id, length, fin)) { | 160 if (stream_->OnDataFrameHeader(stream_id, length, fin)) { |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 CloseConnection("SPDY DATA frame received."); | 163 CloseConnection("SPDY DATA frame received."); |
| 164 } | 164 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 175 } | 175 } |
| 176 switch (id) { | 176 switch (id) { |
| 177 case SETTINGS_HEADER_TABLE_SIZE: | 177 case SETTINGS_HEADER_TABLE_SIZE: |
| 178 stream_->UpdateHeaderEncoderTableSize(value); | 178 stream_->UpdateHeaderEncoderTableSize(value); |
| 179 break; | 179 break; |
| 180 case SETTINGS_ENABLE_PUSH: | 180 case SETTINGS_ENABLE_PUSH: |
| 181 if (FLAGS_quic_enable_server_push_by_default && | 181 if (FLAGS_quic_enable_server_push_by_default && |
| 182 stream_->session()->perspective() == Perspective::IS_SERVER) { | 182 stream_->session()->perspective() == Perspective::IS_SERVER) { |
| 183 // See rfc7540, Section 6.5.2. | 183 // See rfc7540, Section 6.5.2. |
| 184 if (value > 1) { | 184 if (value > 1) { |
| 185 CloseConnection("Invalid value for SETTINGS_ENABLE_PUSH: " + | 185 CloseConnection( |
| 186 base::IntToString(value)); | 186 QuicStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ", value)); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 stream_->UpdateEnableServerPush(value > 0); | 189 stream_->UpdateEnableServerPush(value > 0); |
| 190 break; | 190 break; |
| 191 } else { | 191 } else { |
| 192 CloseConnection("Unsupported field of HTTP/2 SETTINGS frame: " + | 192 CloseConnection( |
| 193 base::IntToString(id)); | 193 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id)); |
| 194 } | 194 } |
| 195 break; | 195 break; |
| 196 // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when | 196 // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when |
| 197 // clients are actually sending it. | 197 // clients are actually sending it. |
| 198 case SETTINGS_MAX_HEADER_LIST_SIZE: | 198 case SETTINGS_MAX_HEADER_LIST_SIZE: |
| 199 if (FLAGS_quic_send_max_header_list_size) { | 199 if (FLAGS_quic_send_max_header_list_size) { |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 default: | 202 default: |
| 203 CloseConnection("Unsupported field of HTTP/2 SETTINGS frame: " + | 203 CloseConnection( |
| 204 base::IntToString(id)); | 204 QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id)); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 void OnSettingsAck() override { | 208 void OnSettingsAck() override { |
| 209 if (!FLAGS_quic_respect_http2_settings_frame) { | 209 if (!FLAGS_quic_respect_http2_settings_frame) { |
| 210 CloseConnection("SPDY SETTINGS frame received."); | 210 CloseConnection("SPDY SETTINGS frame received."); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void OnSettingsEnd() override { | 214 void OnSettingsEnd() override { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 return true; | 626 return true; |
| 627 } | 627 } |
| 628 frame_len_ -= len; | 628 frame_len_ -= len; |
| 629 // Ignore fin_ while there is more data coming, if frame_len_ > 0. | 629 // Ignore fin_ while there is more data coming, if frame_len_ > 0. |
| 630 spdy_session_->OnStreamFrameData(stream_id, data, len, | 630 spdy_session_->OnStreamFrameData(stream_id, data, len, |
| 631 frame_len_ > 0 ? false : fin_); | 631 frame_len_ > 0 ? false : fin_); |
| 632 return true; | 632 return true; |
| 633 } | 633 } |
| 634 | 634 |
| 635 } // namespace net | 635 } // namespace net |
| OLD | NEW |