| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 return ERR_SPDY_PROTOCOL_ERROR; | 450 return ERR_SPDY_PROTOCOL_ERROR; |
| 451 default: | 451 default: |
| 452 NOTREACHED(); | 452 NOTREACHED(); |
| 453 return ERR_SPDY_PROTOCOL_ERROR; | 453 return ERR_SPDY_PROTOCOL_ERROR; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( | 457 SpdyProtocolErrorDetails MapRstStreamStatusToProtocolError( |
| 458 SpdyRstStreamStatus status) { | 458 SpdyRstStreamStatus status) { |
| 459 switch (status) { | 459 switch (status) { |
| 460 case RST_STREAM_NO_ERROR: |
| 461 return STATUS_CODE_NO_ERROR; |
| 460 case RST_STREAM_PROTOCOL_ERROR: | 462 case RST_STREAM_PROTOCOL_ERROR: |
| 461 return STATUS_CODE_PROTOCOL_ERROR; | 463 return STATUS_CODE_PROTOCOL_ERROR; |
| 462 case RST_STREAM_INVALID_STREAM: | |
| 463 return STATUS_CODE_INVALID_STREAM; | |
| 464 case RST_STREAM_REFUSED_STREAM: | |
| 465 return STATUS_CODE_REFUSED_STREAM; | |
| 466 case RST_STREAM_UNSUPPORTED_VERSION: | |
| 467 return STATUS_CODE_UNSUPPORTED_VERSION; | |
| 468 case RST_STREAM_CANCEL: | |
| 469 return STATUS_CODE_CANCEL; | |
| 470 case RST_STREAM_INTERNAL_ERROR: | 464 case RST_STREAM_INTERNAL_ERROR: |
| 471 return STATUS_CODE_INTERNAL_ERROR; | 465 return STATUS_CODE_INTERNAL_ERROR; |
| 472 case RST_STREAM_FLOW_CONTROL_ERROR: | 466 case RST_STREAM_FLOW_CONTROL_ERROR: |
| 473 return STATUS_CODE_FLOW_CONTROL_ERROR; | 467 return STATUS_CODE_FLOW_CONTROL_ERROR; |
| 474 case RST_STREAM_STREAM_IN_USE: | 468 case RST_STREAM_SETTINGS_TIMEOUT: |
| 475 return STATUS_CODE_STREAM_IN_USE; | 469 return STATUS_CODE_SETTINGS_TIMEOUT; |
| 476 case RST_STREAM_STREAM_ALREADY_CLOSED: | 470 case RST_STREAM_STREAM_CLOSED: |
| 477 return STATUS_CODE_STREAM_ALREADY_CLOSED; | 471 return STATUS_CODE_STREAM_CLOSED; |
| 478 case RST_STREAM_FRAME_SIZE_ERROR: | 472 case RST_STREAM_FRAME_SIZE_ERROR: |
| 479 return STATUS_CODE_FRAME_SIZE_ERROR; | 473 return STATUS_CODE_FRAME_SIZE_ERROR; |
| 480 case RST_STREAM_SETTINGS_TIMEOUT: | 474 case RST_STREAM_REFUSED_STREAM: |
| 481 return STATUS_CODE_SETTINGS_TIMEOUT; | 475 return STATUS_CODE_REFUSED_STREAM; |
| 476 case RST_STREAM_CANCEL: |
| 477 return STATUS_CODE_CANCEL; |
| 478 case RST_STREAM_COMPRESSION_ERROR: |
| 479 return STATUS_CODE_COMPRESSION_ERROR; |
| 482 case RST_STREAM_CONNECT_ERROR: | 480 case RST_STREAM_CONNECT_ERROR: |
| 483 return STATUS_CODE_CONNECT_ERROR; | 481 return STATUS_CODE_CONNECT_ERROR; |
| 484 case RST_STREAM_ENHANCE_YOUR_CALM: | 482 case RST_STREAM_ENHANCE_YOUR_CALM: |
| 485 return STATUS_CODE_ENHANCE_YOUR_CALM; | 483 return STATUS_CODE_ENHANCE_YOUR_CALM; |
| 486 case RST_STREAM_INADEQUATE_SECURITY: | 484 case RST_STREAM_INADEQUATE_SECURITY: |
| 487 return STATUS_CODE_INADEQUATE_SECURITY; | 485 return STATUS_CODE_INADEQUATE_SECURITY; |
| 488 case RST_STREAM_HTTP_1_1_REQUIRED: | 486 case RST_STREAM_HTTP_1_1_REQUIRED: |
| 489 return STATUS_CODE_HTTP_1_1_REQUIRED; | 487 return STATUS_CODE_HTTP_1_1_REQUIRED; |
| 490 case RST_STREAM_NO_ERROR: | |
| 491 return STATUS_CODE_NO_ERROR; | |
| 492 default: | 488 default: |
| 493 NOTREACHED(); | 489 NOTREACHED(); |
| 494 return static_cast<SpdyProtocolErrorDetails>(-1); | 490 return static_cast<SpdyProtocolErrorDetails>(-1); |
| 495 } | 491 } |
| 496 } | 492 } |
| 497 | 493 |
| 498 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { | 494 SpdyGoAwayStatus MapNetErrorToGoAwayStatus(Error err) { |
| 499 switch (err) { | 495 switch (err) { |
| 500 case OK: | 496 case OK: |
| 501 return GOAWAY_NO_ERROR; | 497 return GOAWAY_NO_ERROR; |
| (...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2593 RST_STREAM_PROTOCOL_ERROR, | 2589 RST_STREAM_PROTOCOL_ERROR, |
| 2594 "Pushed stream url was invalid: " + gurl.spec()); | 2590 "Pushed stream url was invalid: " + gurl.spec()); |
| 2595 return; | 2591 return; |
| 2596 } | 2592 } |
| 2597 | 2593 |
| 2598 // Verify we have a valid stream association. | 2594 // Verify we have a valid stream association. |
| 2599 ActiveStreamMap::iterator associated_it = | 2595 ActiveStreamMap::iterator associated_it = |
| 2600 active_streams_.find(associated_stream_id); | 2596 active_streams_.find(associated_stream_id); |
| 2601 if (associated_it == active_streams_.end()) { | 2597 if (associated_it == active_streams_.end()) { |
| 2602 EnqueueResetStreamFrame( | 2598 EnqueueResetStreamFrame( |
| 2603 stream_id, | 2599 stream_id, request_priority, RST_STREAM_STREAM_CLOSED, |
| 2604 request_priority, | |
| 2605 RST_STREAM_INVALID_STREAM, | |
| 2606 base::StringPrintf("Received push for inactive associated stream %d", | 2600 base::StringPrintf("Received push for inactive associated stream %d", |
| 2607 associated_stream_id)); | 2601 associated_stream_id)); |
| 2608 return; | 2602 return; |
| 2609 } | 2603 } |
| 2610 | 2604 |
| 2611 DCHECK(gurl.is_valid()); | 2605 DCHECK(gurl.is_valid()); |
| 2612 | 2606 |
| 2613 // Check that the pushed stream advertises the same origin as its associated | 2607 // Check that the pushed stream advertises the same origin as its associated |
| 2614 // stream. Bypass this check if and only if this session is with a SPDY proxy | 2608 // stream. Bypass this check if and only if this session is with a SPDY proxy |
| 2615 // that is trusted explicitly as determined by the |proxy_delegate_| or if the | 2609 // that is trusted explicitly as determined by the |proxy_delegate_| or if the |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3131 if (!queue->empty()) { | 3125 if (!queue->empty()) { |
| 3132 SpdyStreamId stream_id = queue->front(); | 3126 SpdyStreamId stream_id = queue->front(); |
| 3133 queue->pop_front(); | 3127 queue->pop_front(); |
| 3134 return stream_id; | 3128 return stream_id; |
| 3135 } | 3129 } |
| 3136 } | 3130 } |
| 3137 return 0; | 3131 return 0; |
| 3138 } | 3132 } |
| 3139 | 3133 |
| 3140 } // namespace net | 3134 } // namespace net |
| OLD | NEW |