| 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 // HttpStream provides an abstraction for a basic http streams, SPDY, and QUIC. | 5 // HttpStream provides an abstraction for a basic http streams, SPDY, and QUIC. |
| 6 // The HttpStream subtype is expected to manage the underlying transport | 6 // The HttpStream subtype is expected to manage the underlying transport |
| 7 // appropriately. For example, a basic http stream will return the transport | 7 // appropriately. For example, a basic http stream will return the transport |
| 8 // socket to the pool for reuse. SPDY streams on the other hand leave the | 8 // socket to the pool for reuse. SPDY streams on the other hand leave the |
| 9 // transport socket management to the SpdySession. | 9 // transport socket management to the SpdySession. |
| 10 | 10 |
| 11 #ifndef NET_HTTP_HTTP_STREAM_H_ | 11 #ifndef NET_HTTP_HTTP_STREAM_H_ |
| 12 #define NET_HTTP_HTTP_STREAM_H_ | 12 #define NET_HTTP_HTTP_STREAM_H_ |
| 13 | 13 |
| 14 #include <stdint.h> | 14 #include <stdint.h> |
| 15 | 15 |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
| 21 #include "net/base/net_error_details.h" | 21 #include "net/base/net_error_details.h" |
| 22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/base/net_export.h" | 23 #include "net/base/net_export.h" |
| 24 #include "net/base/request_priority.h" | 24 #include "net/base/request_priority.h" |
| 25 #include "net/ssl/token_binding.h" |
| 25 | 26 |
| 26 namespace crypto { | 27 namespace crypto { |
| 27 class ECPrivateKey; | 28 class ECPrivateKey; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace net { | 31 namespace net { |
| 31 | 32 |
| 32 class BoundNetLog; | 33 class BoundNetLog; |
| 33 class HttpNetworkSession; | 34 class HttpNetworkSession; |
| 34 class HttpRequestHeaders; | 35 class HttpRequestHeaders; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // Get the SSLCertRequestInfo associated with this stream's connection. | 151 // Get the SSLCertRequestInfo associated with this stream's connection. |
| 151 // This should only be called for streams over SSL sockets, otherwise the | 152 // This should only be called for streams over SSL sockets, otherwise the |
| 152 // behavior is undefined. | 153 // behavior is undefined. |
| 153 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0; | 154 virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0; |
| 154 | 155 |
| 155 // Gets the remote endpoint of the socket that the HTTP stream is using, if | 156 // Gets the remote endpoint of the socket that the HTTP stream is using, if |
| 156 // any. Returns true and fills in |endpoint| if it is available; returns false | 157 // any. Returns true and fills in |endpoint| if it is available; returns false |
| 157 // and does not modify |endpoint| if it is unavailable. | 158 // and does not modify |endpoint| if it is unavailable. |
| 158 virtual bool GetRemoteEndpoint(IPEndPoint* endpoint) = 0; | 159 virtual bool GetRemoteEndpoint(IPEndPoint* endpoint) = 0; |
| 159 | 160 |
| 160 // Signs the EKM value for Token Binding from the TLS layer using |*key| and | 161 // Generates the signature used in Token Binding using |*key| and for a Token |
| 161 // puts the result in |*out|. Returns OK or ERR_FAILED. | 162 // Binding of type |tb_type|, putting the signature in |*out|. Returns OK or |
| 162 virtual Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, | 163 // ERR_FAILED. |
| 163 std::vector<uint8_t>* out) = 0; | 164 virtual Error GetTokenBindingSignature(crypto::ECPrivateKey* key, |
| 165 TokenBindingType tb_type, |
| 166 std::vector<uint8_t>* out) = 0; |
| 164 | 167 |
| 165 // In the case of an HTTP error or redirect, flush the response body (usually | 168 // In the case of an HTTP error or redirect, flush the response body (usually |
| 166 // a simple error or "this page has moved") so that we can re-use the | 169 // a simple error or "this page has moved") so that we can re-use the |
| 167 // underlying connection. This stream is responsible for deleting itself when | 170 // underlying connection. This stream is responsible for deleting itself when |
| 168 // draining is complete. | 171 // draining is complete. |
| 169 virtual void Drain(HttpNetworkSession* session) = 0; | 172 virtual void Drain(HttpNetworkSession* session) = 0; |
| 170 | 173 |
| 171 // Get the network error details this stream is encountering. | 174 // Get the network error details this stream is encountering. |
| 172 // Fills in |details| if it is available; leaves |details| unchanged if it | 175 // Fills in |details| if it is available; leaves |details| unchanged if it |
| 173 // is unavailable. | 176 // is unavailable. |
| 174 virtual void PopulateNetErrorDetails(NetErrorDetails* details) = 0; | 177 virtual void PopulateNetErrorDetails(NetErrorDetails* details) = 0; |
| 175 | 178 |
| 176 // Called when the priority of the parent transaction changes. | 179 // Called when the priority of the parent transaction changes. |
| 177 virtual void SetPriority(RequestPriority priority) = 0; | 180 virtual void SetPriority(RequestPriority priority) = 0; |
| 178 | 181 |
| 179 // Returns a new (not initialized) stream using the same underlying | 182 // Returns a new (not initialized) stream using the same underlying |
| 180 // connection and invalidates the old stream - no further methods should be | 183 // connection and invalidates the old stream - no further methods should be |
| 181 // called on the old stream. The caller should ensure that the response body | 184 // called on the old stream. The caller should ensure that the response body |
| 182 // from the previous request is drained before calling this method. If the | 185 // from the previous request is drained before calling this method. If the |
| 183 // subclass does not support renewing the stream, NULL is returned. | 186 // subclass does not support renewing the stream, NULL is returned. |
| 184 virtual HttpStream* RenewStreamForAuth() = 0; | 187 virtual HttpStream* RenewStreamForAuth() = 0; |
| 185 | 188 |
| 186 private: | 189 private: |
| 187 DISALLOW_COPY_AND_ASSIGN(HttpStream); | 190 DISALLOW_COPY_AND_ASSIGN(HttpStream); |
| 188 }; | 191 }; |
| 189 | 192 |
| 190 } // namespace net | 193 } // namespace net |
| 191 | 194 |
| 192 #endif // NET_HTTP_HTTP_STREAM_H_ | 195 #endif // NET_HTTP_HTTP_STREAM_H_ |
| OLD | NEW |