| 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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 default: | 1624 default: |
| 1625 return GURL(); | 1625 return GURL(); |
| 1626 } | 1626 } |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 bool HttpNetworkTransaction::ForWebSocketHandshake() const { | 1629 bool HttpNetworkTransaction::ForWebSocketHandshake() const { |
| 1630 return websocket_handshake_stream_base_create_helper_ && | 1630 return websocket_handshake_stream_base_create_helper_ && |
| 1631 request_->url.SchemeIsWSOrWSS(); | 1631 request_->url.SchemeIsWSOrWSS(); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 #define STATE_CASE(s) \ | |
| 1635 case s: \ | |
| 1636 description = base::StringPrintf("%s (0x%08X)", #s, s); \ | |
| 1637 break | |
| 1638 | |
| 1639 std::string HttpNetworkTransaction::DescribeState(State state) { | |
| 1640 std::string description; | |
| 1641 switch (state) { | |
| 1642 STATE_CASE(STATE_NOTIFY_BEFORE_CREATE_STREAM); | |
| 1643 STATE_CASE(STATE_CREATE_STREAM); | |
| 1644 STATE_CASE(STATE_CREATE_STREAM_COMPLETE); | |
| 1645 STATE_CASE(STATE_INIT_REQUEST_BODY); | |
| 1646 STATE_CASE(STATE_INIT_REQUEST_BODY_COMPLETE); | |
| 1647 STATE_CASE(STATE_BUILD_REQUEST); | |
| 1648 STATE_CASE(STATE_BUILD_REQUEST_COMPLETE); | |
| 1649 STATE_CASE(STATE_SEND_REQUEST); | |
| 1650 STATE_CASE(STATE_SEND_REQUEST_COMPLETE); | |
| 1651 STATE_CASE(STATE_READ_HEADERS); | |
| 1652 STATE_CASE(STATE_READ_HEADERS_COMPLETE); | |
| 1653 STATE_CASE(STATE_READ_BODY); | |
| 1654 STATE_CASE(STATE_READ_BODY_COMPLETE); | |
| 1655 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART); | |
| 1656 STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE); | |
| 1657 STATE_CASE(STATE_NONE); | |
| 1658 default: | |
| 1659 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | |
| 1660 state); | |
| 1661 break; | |
| 1662 } | |
| 1663 return description; | |
| 1664 } | |
| 1665 | |
| 1666 #undef STATE_CASE | |
| 1667 | |
| 1668 void HttpNetworkTransaction::CopyConnectionAttemptsFromStreamRequest() { | 1634 void HttpNetworkTransaction::CopyConnectionAttemptsFromStreamRequest() { |
| 1669 DCHECK(stream_request_); | 1635 DCHECK(stream_request_); |
| 1670 | 1636 |
| 1671 // Since the transaction can restart with auth credentials, it may create a | 1637 // Since the transaction can restart with auth credentials, it may create a |
| 1672 // stream more than once. Accumulate all of the connection attempts across | 1638 // stream more than once. Accumulate all of the connection attempts across |
| 1673 // those streams by appending them to the vector: | 1639 // those streams by appending them to the vector: |
| 1674 for (const auto& attempt : stream_request_->connection_attempts()) | 1640 for (const auto& attempt : stream_request_->connection_attempts()) |
| 1675 connection_attempts_.push_back(attempt); | 1641 connection_attempts_.push_back(attempt); |
| 1676 } | 1642 } |
| 1677 | 1643 |
| 1678 } // namespace net | 1644 } // namespace net |
| OLD | NEW |