OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #ifndef NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ | 5 #ifndef NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ |
6 #define NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ | 6 #define NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ |
7 | 7 |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 void OnResponseHeaders(const SpdyHeaderBlock& response_headers); | 47 void OnResponseHeaders(const SpdyHeaderBlock& response_headers); |
48 | 48 |
49 // Rendezvous between this promised stream and a client request that | 49 // Rendezvous between this promised stream and a client request that |
50 // has a matching URL. | 50 // has a matching URL. |
51 virtual QuicAsyncStatus HandleClientRequest( | 51 virtual QuicAsyncStatus HandleClientRequest( |
52 const SpdyHeaderBlock& headers, | 52 const SpdyHeaderBlock& headers, |
53 QuicClientPushPromiseIndex::Delegate* delegate); | 53 QuicClientPushPromiseIndex::Delegate* delegate); |
54 | 54 |
55 void Cancel() override; | 55 void Cancel() override; |
56 | 56 |
| 57 void Reset(QuicRstStreamErrorCode error_code); |
| 58 |
57 // Client requests are initially associated to promises by matching | 59 // Client requests are initially associated to promises by matching |
58 // URL in the client request against the URL in the promise headers, | 60 // URL in the client request against the URL in the promise headers, |
59 // uing the |promised_by_url| map. The push can be cross-origin, so | 61 // uing the |promised_by_url| map. The push can be cross-origin, so |
60 // the client should validate that the session is authoritative for | 62 // the client should validate that the session is authoritative for |
61 // the promised URL. If not, it should call |RejectUnauthorized|. | 63 // the promised URL. If not, it should call |RejectUnauthorized|. |
62 QuicClientSessionBase* session() { return session_; } | 64 QuicClientSessionBase* session() { return session_; } |
63 | 65 |
64 // If the promised response contains Vary header, then the fields | 66 // If the promised response contains Vary header, then the fields |
65 // specified by Vary must match between the client request header | 67 // specified by Vary must match between the client request header |
66 // and the promise headers (see https://crbug.com//554220). Vary | 68 // and the promise headers (see https://crbug.com//554220). Vary |
(...skipping 14 matching lines...) Expand all Loading... |
81 class CleanupAlarm : public QuicAlarm::Delegate { | 83 class CleanupAlarm : public QuicAlarm::Delegate { |
82 public: | 84 public: |
83 explicit CleanupAlarm(QuicClientPromisedInfo* promised) | 85 explicit CleanupAlarm(QuicClientPromisedInfo* promised) |
84 : promised_(promised) {} | 86 : promised_(promised) {} |
85 | 87 |
86 void OnAlarm() override; | 88 void OnAlarm() override; |
87 | 89 |
88 QuicClientPromisedInfo* promised_; | 90 QuicClientPromisedInfo* promised_; |
89 }; | 91 }; |
90 | 92 |
91 void Reset(QuicRstStreamErrorCode error_code); | |
92 | |
93 QuicAsyncStatus FinalValidation(); | 93 QuicAsyncStatus FinalValidation(); |
94 | 94 |
95 QuicClientSessionBase* session_; | 95 QuicClientSessionBase* session_; |
96 QuicStreamId id_; | 96 QuicStreamId id_; |
97 std::string url_; | 97 std::string url_; |
98 std::unique_ptr<SpdyHeaderBlock> request_headers_; | 98 std::unique_ptr<SpdyHeaderBlock> request_headers_; |
99 std::unique_ptr<SpdyHeaderBlock> response_headers_; | 99 std::unique_ptr<SpdyHeaderBlock> response_headers_; |
100 std::unique_ptr<SpdyHeaderBlock> client_request_headers_; | 100 std::unique_ptr<SpdyHeaderBlock> client_request_headers_; |
101 QuicClientPushPromiseIndex::Delegate* client_request_delegate_; | 101 QuicClientPushPromiseIndex::Delegate* client_request_delegate_; |
102 | 102 |
103 // The promise will commit suicide eventually if it is not claimed | 103 // The promise will commit suicide eventually if it is not claimed |
104 // by a GET first. | 104 // by a GET first. |
105 std::unique_ptr<QuicAlarm> cleanup_alarm_; | 105 std::unique_ptr<QuicAlarm> cleanup_alarm_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(QuicClientPromisedInfo); | 107 DISALLOW_COPY_AND_ASSIGN(QuicClientPromisedInfo); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace net | 110 } // namespace net |
111 | 111 |
112 #endif // NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ | 112 #endif // NET_QUIC_QUIC_CLIENT_PROMISED_INFO_H_ |
OLD | NEW |