OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 "Pushed stream url was invalid: " + url); | 1322 "Pushed stream url was invalid: " + url); |
1323 LOG(WARNING) << "Pushed stream url was invalid: " << url; | 1323 LOG(WARNING) << "Pushed stream url was invalid: " << url; |
1324 return; | 1324 return; |
1325 } | 1325 } |
1326 | 1326 |
1327 // Verify we have a valid stream association. | 1327 // Verify we have a valid stream association. |
1328 if (!IsStreamActive(associated_stream_id)) { | 1328 if (!IsStreamActive(associated_stream_id)) { |
1329 LOG(WARNING) << "Received OnSyn with inactive associated stream " | 1329 LOG(WARNING) << "Received OnSyn with inactive associated stream " |
1330 << associated_stream_id; | 1330 << associated_stream_id; |
1331 ResetStream(stream_id, spdy::INVALID_ASSOCIATED_STREAM, | 1331 ResetStream(stream_id, spdy::INVALID_ASSOCIATED_STREAM, |
1332 "Received OnSyn with inactive associated stream " + | 1332 base::StringPrintf( |
1333 associated_stream_id); | 1333 "Received OnSyn with inactive associated stream %d", |
| 1334 associated_stream_id)); |
1334 return; | 1335 return; |
1335 } | 1336 } |
1336 | 1337 |
1337 scoped_refptr<SpdyStream> associated_stream = | 1338 scoped_refptr<SpdyStream> associated_stream = |
1338 active_streams_[associated_stream_id]; | 1339 active_streams_[associated_stream_id]; |
1339 GURL associated_url(associated_stream->GetUrl()); | 1340 GURL associated_url(associated_stream->GetUrl()); |
1340 if (associated_url.GetOrigin() != gurl.GetOrigin()) { | 1341 if (associated_url.GetOrigin() != gurl.GetOrigin()) { |
1341 LOG(WARNING) << "Rejected Cross Origin Push Stream " | 1342 LOG(WARNING) << "Rejected Cross Origin Push Stream " |
1342 << associated_stream_id; | 1343 << associated_stream_id; |
1343 ResetStream(stream_id, spdy::REFUSED_STREAM, | 1344 ResetStream(stream_id, spdy::REFUSED_STREAM, |
1344 "Rejected Cross Origin Push Stream " + associated_stream_id); | 1345 base::StringPrintf( |
| 1346 "Rejected Cross Origin Push Stream %d", |
| 1347 associated_stream_id)); |
1345 return; | 1348 return; |
1346 } | 1349 } |
1347 | 1350 |
1348 // There should not be an existing pushed stream with the same path. | 1351 // There should not be an existing pushed stream with the same path. |
1349 PushedStreamMap::iterator it = unclaimed_pushed_streams_.find(url); | 1352 PushedStreamMap::iterator it = unclaimed_pushed_streams_.find(url); |
1350 if (it != unclaimed_pushed_streams_.end()) { | 1353 if (it != unclaimed_pushed_streams_.end()) { |
1351 LOG(WARNING) << "Received duplicate pushed stream with url: " << url; | 1354 LOG(WARNING) << "Received duplicate pushed stream with url: " << url; |
1352 ResetStream(stream_id, spdy::PROTOCOL_ERROR, | 1355 ResetStream(stream_id, spdy::PROTOCOL_ERROR, |
1353 "Received duplicate pushed stream with url: " + url); | 1356 "Received duplicate pushed stream with url: " + url); |
1354 return; | 1357 return; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 | 1605 |
1603 if (!IsStreamActive(stream_id)) { | 1606 if (!IsStreamActive(stream_id)) { |
1604 LOG(WARNING) << "Received WINDOW_UPDATE for invalid stream " << stream_id; | 1607 LOG(WARNING) << "Received WINDOW_UPDATE for invalid stream " << stream_id; |
1605 return; | 1608 return; |
1606 } | 1609 } |
1607 | 1610 |
1608 if (delta_window_size < 1) { | 1611 if (delta_window_size < 1) { |
1609 LOG(WARNING) << "Received WINDOW_UPDATE with an invalid delta_window_size " | 1612 LOG(WARNING) << "Received WINDOW_UPDATE with an invalid delta_window_size " |
1610 << delta_window_size; | 1613 << delta_window_size; |
1611 ResetStream(stream_id, spdy::FLOW_CONTROL_ERROR, | 1614 ResetStream(stream_id, spdy::FLOW_CONTROL_ERROR, |
1612 "Received WINDOW_UPDATE with an invalid delta_window_size " | 1615 base::StringPrintf( |
1613 + delta_window_size); | 1616 "Received WINDOW_UPDATE with an invalid " |
| 1617 "delta_window_size %d", delta_window_size)); |
1614 return; | 1618 return; |
1615 } | 1619 } |
1616 | 1620 |
1617 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; | 1621 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; |
1618 CHECK_EQ(stream->stream_id(), stream_id); | 1622 CHECK_EQ(stream->stream_id(), stream_id); |
1619 CHECK(!stream->cancelled()); | 1623 CHECK(!stream->cancelled()); |
1620 | 1624 |
1621 if (flow_control_) | 1625 if (flow_control_) |
1622 stream->IncreaseSendWindowSize(delta_window_size); | 1626 stream->IncreaseSendWindowSize(delta_window_size); |
1623 } | 1627 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 if (it == pending_callback_map_.end()) | 1926 if (it == pending_callback_map_.end()) |
1923 return; | 1927 return; |
1924 | 1928 |
1925 CompletionCallback callback = it->second.callback; | 1929 CompletionCallback callback = it->second.callback; |
1926 int result = it->second.result; | 1930 int result = it->second.result; |
1927 pending_callback_map_.erase(it); | 1931 pending_callback_map_.erase(it); |
1928 callback.Run(result); | 1932 callback.Run(result); |
1929 } | 1933 } |
1930 | 1934 |
1931 } // namespace net | 1935 } // namespace net |
OLD | NEW |