| 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/chromium/spdy_session.h" | 5 #include "net/spdy/chromium/spdy_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 streams_pushed_count_++; | 1586 streams_pushed_count_++; |
| 1587 | 1587 |
| 1588 // TODO(mbelshe): DCHECK that this is a GET method? | 1588 // TODO(mbelshe): DCHECK that this is a GET method? |
| 1589 | 1589 |
| 1590 // Verify that the response had a URL for us. | 1590 // Verify that the response had a URL for us. |
| 1591 GURL gurl = GetUrlFromHeaderBlock(headers); | 1591 GURL gurl = GetUrlFromHeaderBlock(headers); |
| 1592 if (!gurl.is_valid()) { | 1592 if (!gurl.is_valid()) { |
| 1593 EnqueueResetStreamFrame( | 1593 EnqueueResetStreamFrame( |
| 1594 stream_id, request_priority, ERROR_CODE_PROTOCOL_ERROR, | 1594 stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, |
| 1595 "Pushed stream url was invalid: " + gurl.possibly_invalid_spec()); | 1595 "Pushed stream url was invalid: " + gurl.possibly_invalid_spec()); |
| 1596 return; | 1596 return; |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 // Verify we have a valid stream association. | 1599 // Verify we have a valid stream association. |
| 1600 ActiveStreamMap::iterator associated_it = | 1600 ActiveStreamMap::iterator associated_it = |
| 1601 active_streams_.find(associated_stream_id); | 1601 active_streams_.find(associated_stream_id); |
| 1602 if (associated_it == active_streams_.end()) { | 1602 if (associated_it == active_streams_.end()) { |
| 1603 EnqueueResetStreamFrame( | 1603 EnqueueResetStreamFrame( |
| 1604 stream_id, request_priority, ERROR_CODE_STREAM_CLOSED, | 1604 stream_id, request_priority, ERROR_CODE_STREAM_CLOSED, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 } | 1653 } |
| 1654 } | 1654 } |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 // There should not be an existing pushed stream with the same path. | 1657 // There should not be an existing pushed stream with the same path. |
| 1658 UnclaimedPushedStreamContainer::const_iterator pushed_it = | 1658 UnclaimedPushedStreamContainer::const_iterator pushed_it = |
| 1659 unclaimed_pushed_streams_.lower_bound(gurl); | 1659 unclaimed_pushed_streams_.lower_bound(gurl); |
| 1660 if (pushed_it != unclaimed_pushed_streams_.end() && | 1660 if (pushed_it != unclaimed_pushed_streams_.end() && |
| 1661 pushed_it->first == gurl) { | 1661 pushed_it->first == gurl) { |
| 1662 EnqueueResetStreamFrame( | 1662 EnqueueResetStreamFrame( |
| 1663 stream_id, request_priority, ERROR_CODE_PROTOCOL_ERROR, | 1663 stream_id, request_priority, ERROR_CODE_REFUSED_STREAM, |
| 1664 "Received duplicate pushed stream with url: " + gurl.spec()); | 1664 "Received duplicate pushed stream with url: " + gurl.spec()); |
| 1665 return; | 1665 return; |
| 1666 } | 1666 } |
| 1667 | 1667 |
| 1668 auto stream = base::MakeUnique<SpdyStream>( | 1668 auto stream = base::MakeUnique<SpdyStream>( |
| 1669 SPDY_PUSH_STREAM, GetWeakPtr(), gurl, request_priority, | 1669 SPDY_PUSH_STREAM, GetWeakPtr(), gurl, request_priority, |
| 1670 stream_initial_send_window_size_, stream_max_recv_window_size_, net_log_); | 1670 stream_initial_send_window_size_, stream_max_recv_window_size_, net_log_); |
| 1671 stream->set_stream_id(stream_id); | 1671 stream->set_stream_id(stream_id); |
| 1672 | 1672 |
| 1673 // Convert RequestPriority to a SpdyPriority to send in a PRIORITY frame. | 1673 // Convert RequestPriority to a SpdyPriority to send in a PRIORITY frame. |
| (...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 if (!queue->empty()) { | 3189 if (!queue->empty()) { |
| 3190 SpdyStreamId stream_id = queue->front(); | 3190 SpdyStreamId stream_id = queue->front(); |
| 3191 queue->pop_front(); | 3191 queue->pop_front(); |
| 3192 return stream_id; | 3192 return stream_id; |
| 3193 } | 3193 } |
| 3194 } | 3194 } |
| 3195 return 0; | 3195 return 0; |
| 3196 } | 3196 } |
| 3197 | 3197 |
| 3198 } // namespace net | 3198 } // namespace net |
| OLD | NEW |