Chromium Code Reviews| 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 #ifndef NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ | 5 #ifndef NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ |
| 6 #define NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ | 6 #define NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 int DoSendBody(); | 127 int DoSendBody(); |
| 128 int DoSendBodyComplete(int rv); | 128 int DoSendBodyComplete(int rv); |
| 129 | 129 |
| 130 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); | 130 int ProcessResponseHeaders(const SpdyHeaderBlock& headers); |
| 131 | 131 |
| 132 int ReadAvailableData(IOBuffer* buf, int buf_len); | 132 int ReadAvailableData(IOBuffer* buf, int buf_len); |
| 133 void EnterStateSendHeaders(); | 133 void EnterStateSendHeaders(); |
| 134 | 134 |
| 135 void ResetStream(); | 135 void ResetStream(); |
| 136 | 136 |
| 137 // If |has_response_status_| is false, sets |response_status| to the result | |
| 138 // of ComputeResponseStatus(). Returns |response_status_|. | |
| 139 int GetResponseStatus(); | |
|
Buck
2017/03/28 21:19:57
There seem to be instances where the return value
Ryan Hamilton
2017/03/28 21:54:03
Good idea. I thought about that but couldn't decid
| |
| 140 // Sets |response_status_| to |response_status| and sets | |
| 141 // |has_response_status_| to true. | |
| 142 void SetResponseStatus(int response_status); | |
| 143 // Computes the correct response status based on the status of the handshake, | |
| 144 // |session_error|, |connection_error| and |stream_error|. | |
| 145 int ComputeResponseStatus() const; | |
| 146 | |
| 137 State next_state_; | 147 State next_state_; |
| 138 | 148 |
| 139 base::WeakPtr<QuicChromiumClientSession> session_; | 149 base::WeakPtr<QuicChromiumClientSession> session_; |
| 140 QuicVersion quic_version_; | 150 QuicVersion quic_version_; |
| 141 int session_error_; // Error code from the connection shutdown. | 151 int session_error_; // Error code from the connection shutdown. |
| 142 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | 152 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. |
| 143 QuicChromiumClientSession::StreamRequest stream_request_; | 153 QuicChromiumClientSession::StreamRequest stream_request_; |
| 144 QuicChromiumClientStream* stream_; // Non-owning. | 154 QuicChromiumClientStream* stream_; // Non-owning. |
| 145 | 155 |
| 146 // The following three fields are all owned by the caller and must | 156 // The following three fields are all owned by the caller and must |
| 147 // outlive this object, according to the HttpStream contract. | 157 // outlive this object, according to the HttpStream contract. |
| 148 | 158 |
| 149 // The request to send. | 159 // The request to send. |
| 150 // Only valid before the response body is read. | 160 // Only valid before the response body is read. |
| 151 const HttpRequestInfo* request_info_; | 161 const HttpRequestInfo* request_info_; |
| 152 | 162 |
| 153 // The request body to send, if any, owned by the caller. | 163 // The request body to send, if any, owned by the caller. |
| 154 UploadDataStream* request_body_stream_; | 164 UploadDataStream* request_body_stream_; |
| 155 // Time the request was issued. | 165 // Time the request was issued. |
| 156 base::Time request_time_; | 166 base::Time request_time_; |
| 157 // The priority of the request. | 167 // The priority of the request. |
| 158 RequestPriority priority_; | 168 RequestPriority priority_; |
| 159 // |response_info_| is the HTTP response data object which is filled in | 169 // |response_info_| is the HTTP response data object which is filled in |
| 160 // when a the response headers are read. It is not owned by this stream. | 170 // when a the response headers are read. It is not owned by this stream. |
| 161 HttpResponseInfo* response_info_; | 171 HttpResponseInfo* response_info_; |
| 172 bool has_response_status_; // true if response_status_ as been set. | |
| 162 // Because response data is buffered, also buffer the response status if the | 173 // Because response data is buffered, also buffer the response status if the |
| 163 // stream is explicitly closed via OnError or OnClose with an error. | 174 // stream is explicitly closed via OnError or OnClose with an error. |
| 164 // Once all buffered data has been returned, this will be used as the final | 175 // Once all buffered data has been returned, this will be used as the final |
| 165 // response. | 176 // response. |
| 166 int response_status_; | 177 int response_status_; |
| 167 | 178 |
| 168 // Serialized request headers. | 179 // Serialized request headers. |
| 169 SpdyHeaderBlock request_headers_; | 180 SpdyHeaderBlock request_headers_; |
| 170 | 181 |
| 171 bool response_headers_received_; | 182 bool response_headers_received_; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 191 scoped_refptr<IOBuffer> user_buffer_; | 202 scoped_refptr<IOBuffer> user_buffer_; |
| 192 int user_buffer_len_; | 203 int user_buffer_len_; |
| 193 | 204 |
| 194 // Temporary buffer used to read the request body from UploadDataStream. | 205 // Temporary buffer used to read the request body from UploadDataStream. |
| 195 scoped_refptr<IOBufferWithSize> raw_request_body_buf_; | 206 scoped_refptr<IOBufferWithSize> raw_request_body_buf_; |
| 196 // Wraps raw_request_body_buf_ to read the remaining data progressively. | 207 // Wraps raw_request_body_buf_ to read the remaining data progressively. |
| 197 scoped_refptr<DrainableIOBuffer> request_body_buf_; | 208 scoped_refptr<DrainableIOBuffer> request_body_buf_; |
| 198 | 209 |
| 199 NetLogWithSource stream_net_log_; | 210 NetLogWithSource stream_net_log_; |
| 200 | 211 |
| 201 QuicErrorCode quic_connection_error_; | 212 QuicErrorCode quic_connection_error_; // Cached connection error code. |
| 213 QuicRstStreamErrorCode quic_stream_error_; // Cached stream error code. | |
| 202 | 214 |
| 203 // True when this stream receives a go away from server due to port migration. | 215 // True when this stream receives a go away from server due to port migration. |
| 204 bool port_migration_detected_; | 216 bool port_migration_detected_; |
| 205 | 217 |
| 206 bool found_promise_; | 218 bool found_promise_; |
| 207 // |QuicClientPromisedInfo| owns this. It will be set when |Try()| | 219 // |QuicClientPromisedInfo| owns this. It will be set when |Try()| |
| 208 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid | 220 // is asynchronous, i.e. it returned QUIC_PENDING, and remains valid |
| 209 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is | 221 // until |OnRendezvouResult()| fires or |push_handle_->Cancel()| is |
| 210 // invoked. | 222 // invoked. |
| 211 QuicClientPushPromiseIndex::TryHandle* push_handle_; | 223 QuicClientPushPromiseIndex::TryHandle* push_handle_; |
| 212 | 224 |
| 213 // Set to true when DoLoop() is being executed, false otherwise. | 225 // Set to true when DoLoop() is being executed, false otherwise. |
| 214 bool in_loop_; | 226 bool in_loop_; |
| 215 | 227 |
| 216 // Session connect timing info. | 228 // Session connect timing info. |
| 217 LoadTimingInfo::ConnectTiming connect_timing_; | 229 LoadTimingInfo::ConnectTiming connect_timing_; |
| 218 | 230 |
| 219 base::WeakPtrFactory<QuicHttpStream> weak_factory_; | 231 base::WeakPtrFactory<QuicHttpStream> weak_factory_; |
| 220 | 232 |
| 221 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); | 233 DISALLOW_COPY_AND_ASSIGN(QuicHttpStream); |
| 222 }; | 234 }; |
| 223 | 235 |
| 224 } // namespace net | 236 } // namespace net |
| 225 | 237 |
| 226 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ | 238 #endif // NET_QUIC_CHROMIUM_QUIC_HTTP_STREAM_H_ |
| OLD | NEW |