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

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

Issue 2141993002: Remove many-many SpdyMajorVersion and NextProto arguments and members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove OnSynStream() and OnSynReply(). 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
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 std::string request_line; 358 std::string request_line;
359 BuildTunnelRequest(endpoint_, authorization_headers, user_agent_, 359 BuildTunnelRequest(endpoint_, authorization_headers, user_agent_,
360 &request_line, &request_.extra_headers); 360 &request_line, &request_.extra_headers);
361 361
362 net_log_.AddEvent( 362 net_log_.AddEvent(
363 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 363 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
364 base::Bind(&HttpRequestHeaders::NetLogCallback, 364 base::Bind(&HttpRequestHeaders::NetLogCallback,
365 base::Unretained(&request_.extra_headers), &request_line)); 365 base::Unretained(&request_.extra_headers), &request_line));
366 366
367 std::unique_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock()); 367 std::unique_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock());
368 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers, 368 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers, true,
369 spdy_stream_->GetProtocolVersion(), true,
370 headers.get()); 369 headers.get());
371 370
372 return spdy_stream_->SendRequestHeaders(std::move(headers), 371 return spdy_stream_->SendRequestHeaders(std::move(headers),
373 MORE_DATA_TO_SEND); 372 MORE_DATA_TO_SEND);
374 } 373 }
375 374
376 int SpdyProxyClientSocket::DoSendRequestComplete(int result) { 375 int SpdyProxyClientSocket::DoSendRequestComplete(int result) {
377 if (result < 0) 376 if (result < 0)
378 return result; 377 return result;
379 378
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 443
445 SpdyResponseHeadersStatus SpdyProxyClientSocket::OnResponseHeadersUpdated( 444 SpdyResponseHeadersStatus SpdyProxyClientSocket::OnResponseHeadersUpdated(
446 const SpdyHeaderBlock& response_headers) { 445 const SpdyHeaderBlock& response_headers) {
447 // If we've already received the reply, existing headers are too late. 446 // If we've already received the reply, existing headers are too late.
448 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the 447 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the
449 // initial response. 448 // initial response.
450 if (next_state_ != STATE_READ_REPLY_COMPLETE) 449 if (next_state_ != STATE_READ_REPLY_COMPLETE)
451 return RESPONSE_HEADERS_ARE_COMPLETE; 450 return RESPONSE_HEADERS_ARE_COMPLETE;
452 451
453 // Save the response 452 // Save the response
454 if (!SpdyHeadersToHttpResponse( 453 if (!SpdyHeadersToHttpResponse(response_headers, &response_))
455 response_headers, spdy_stream_->GetProtocolVersion(), &response_))
456 return RESPONSE_HEADERS_ARE_INCOMPLETE; 454 return RESPONSE_HEADERS_ARE_INCOMPLETE;
457 455
458 OnIOComplete(OK); 456 OnIOComplete(OK);
459 return RESPONSE_HEADERS_ARE_COMPLETE; 457 return RESPONSE_HEADERS_ARE_COMPLETE;
460 } 458 }
461 459
462 // Called when data is received or on EOF (if |buffer| is NULL). 460 // Called when data is received or on EOF (if |buffer| is NULL).
463 void SpdyProxyClientSocket::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) { 461 void SpdyProxyClientSocket::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) {
464 if (buffer) { 462 if (buffer) {
465 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED, 463 net_log_.AddByteTransferEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 } else if (!read_callback_.is_null()) { 524 } else if (!read_callback_.is_null()) {
527 // 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.
528 OnDataReceived(std::unique_ptr<SpdyBuffer>()); 526 OnDataReceived(std::unique_ptr<SpdyBuffer>());
529 } 527 }
530 // This may have been deleted by read_callback_, so check first. 528 // This may have been deleted by read_callback_, so check first.
531 if (weak_ptr.get() && !write_callback.is_null()) 529 if (weak_ptr.get() && !write_callback.is_null())
532 write_callback.Run(ERR_CONNECTION_CLOSED); 530 write_callback.Run(ERR_CONNECTION_CLOSED);
533 } 531 }
534 532
535 } // namespace net 533 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698