Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 2167253002: s/SYN_STREAM/HEADERS/ in frame types, method names, comments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_proxy_client_socket.h" 5 #include "net/spdy/spdy_proxy_client_socket.h"
6 6
7 #include <algorithm> // min 7 #include <algorithm> // min
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 spdy_stream_->GetSSLInfo(&ssl_info, &was_npn_negotiated, 94 spdy_stream_->GetSSLInfo(&ssl_info, &was_npn_negotiated,
95 &protocol_negotiated); 95 &protocol_negotiated);
96 return protocol_negotiated; 96 return protocol_negotiated;
97 } 97 }
98 98
99 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() { 99 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() {
100 return new ProxyConnectRedirectHttpStream( 100 return new ProxyConnectRedirectHttpStream(
101 redirect_has_load_timing_info_ ? &redirect_load_timing_info_ : NULL); 101 redirect_has_load_timing_info_ ? &redirect_load_timing_info_ : NULL);
102 } 102 }
103 103
104 // Sends a SYN_STREAM frame to the proxy with a CONNECT request 104 // Sends a HEADERS frame to the proxy with a CONNECT request
105 // for the specified endpoint. Waits for the server to send back 105 // for the specified endpoint. Waits for the server to send back
106 // a SYN_REPLY frame. OK will be returned if the status is 200. 106 // a HEADERS frame. OK will be returned if the status is 200.
107 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status. 107 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status.
108 // In any of these cases, Read() may be called to retrieve the HTTP 108 // In any of these cases, Read() may be called to retrieve the HTTP
109 // response body. Any other return values should be considered fatal. 109 // response body. Any other return values should be considered fatal.
110 // TODO(rch): handle 407 proxy auth requested correctly, perhaps 110 // TODO(rch): handle 407 proxy auth requested correctly, perhaps
111 // by creating a new stream for the subsequent request. 111 // by creating a new stream for the subsequent request.
112 // TODO(rch): create a more appropriate error code to disambiguate 112 // TODO(rch): create a more appropriate error code to disambiguate
113 // the HTTPS Proxy tunnel failure from an HTTP Proxy tunnel failure. 113 // the HTTPS Proxy tunnel failure from an HTTP Proxy tunnel failure.
114 int SpdyProxyClientSocket::Connect(const CompletionCallback& callback) { 114 int SpdyProxyClientSocket::Connect(const CompletionCallback& callback) {
115 DCHECK(read_callback_.is_null()); 115 DCHECK(read_callback_.is_null());
116 if (next_state_ == STATE_OPEN) 116 if (next_state_ == STATE_OPEN)
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 &headers); 369 &headers);
370 370
371 return spdy_stream_->SendRequestHeaders(std::move(headers), 371 return spdy_stream_->SendRequestHeaders(std::move(headers),
372 MORE_DATA_TO_SEND); 372 MORE_DATA_TO_SEND);
373 } 373 }
374 374
375 int SpdyProxyClientSocket::DoSendRequestComplete(int result) { 375 int SpdyProxyClientSocket::DoSendRequestComplete(int result) {
376 if (result < 0) 376 if (result < 0)
377 return result; 377 return result;
378 378
379 // Wait for SYN_REPLY frame from the server 379 // Wait for HEADERS frame from the server
380 next_state_ = STATE_READ_REPLY_COMPLETE; 380 next_state_ = STATE_READ_REPLY_COMPLETE;
381 return ERR_IO_PENDING; 381 return ERR_IO_PENDING;
382 } 382 }
383 383
384 int SpdyProxyClientSocket::DoReadReplyComplete(int result) { 384 int SpdyProxyClientSocket::DoReadReplyComplete(int result) {
385 // We enter this method directly from DoSendRequestComplete, since 385 // We enter this method directly from DoSendRequestComplete, since
386 // we are notified by a callback when the SYN_REPLY frame arrives 386 // we are notified by a callback when the HEADERS frame arrives.
387 387
388 if (result < 0) 388 if (result < 0)
389 return result; 389 return result;
390 390
391 // Require the "HTTP/1.x" status line for SSL CONNECT. 391 // Require the "HTTP/1.x" status line for SSL CONNECT.
392 if (response_.headers->GetHttpVersion() < HttpVersion(1, 0)) 392 if (response_.headers->GetHttpVersion() < HttpVersion(1, 0))
393 return ERR_TUNNEL_CONNECTION_FAILED; 393 return ERR_TUNNEL_CONNECTION_FAILED;
394 394
395 net_log_.AddEvent( 395 net_log_.AddEvent(
396 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, 396 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } else if (!read_callback_.is_null()) { 524 } else if (!read_callback_.is_null()) {
525 // If we have a read_callback_, the we need to make sure we call it back. 525 // If we have a read_callback_, the we need to make sure we call it back.
526 OnDataReceived(std::unique_ptr<SpdyBuffer>()); 526 OnDataReceived(std::unique_ptr<SpdyBuffer>());
527 } 527 }
528 // This may have been deleted by read_callback_, so check first. 528 // This may have been deleted by read_callback_, so check first.
529 if (weak_ptr.get() && !write_callback.is_null()) 529 if (weak_ptr.get() && !write_callback.is_null())
530 write_callback.Run(ERR_CONNECTION_CLOSED); 530 write_callback.Run(ERR_CONNECTION_CLOSED);
531 } 531 }
532 532
533 } // namespace net 533 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698