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

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

Issue 9958023: Properly handle spdy3 responses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 8 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 | Annotate | Revision Log
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 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 const SpdyHeaderBlock& response, 465 const SpdyHeaderBlock& response,
466 base::Time response_time, 466 base::Time response_time,
467 int status) { 467 int status) {
468 // If we've already received the reply, existing headers are too late. 468 // If we've already received the reply, existing headers are too late.
469 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the 469 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the
470 // initial response. 470 // initial response.
471 if (next_state_ != STATE_READ_REPLY_COMPLETE) 471 if (next_state_ != STATE_READ_REPLY_COMPLETE)
472 return OK; 472 return OK;
473 473
474 // Save the response 474 // Save the response
475 int rv = SpdyHeadersToHttpResponse(response, &response_); 475 if (!SpdyHeadersToHttpResponse(
476 if (rv == ERR_INCOMPLETE_SPDY_HEADERS) 476 response, spdy_stream_->GetProtocolVersion(), &response_))
477 return rv; // More headers are coming. 477 return ERR_INCOMPLETE_SPDY_HEADERS;
478 478
479 OnIOComplete(status); 479 OnIOComplete(status);
480 return OK; 480 return OK;
481 } 481 }
482 482
483 // Called when data is received. 483 // Called when data is received.
484 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { 484 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) {
485 if (length > 0) { 485 if (length > 0) {
486 // Save the received data. 486 // Save the received data.
487 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); 487 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 } 547 }
548 // This may have been deleted by read_callback_, so check first. 548 // This may have been deleted by read_callback_, so check first.
549 if (weak_ptr && !write_callback.is_null()) 549 if (weak_ptr && !write_callback.is_null())
550 write_callback.Run(ERR_CONNECTION_CLOSED); 550 write_callback.Run(ERR_CONNECTION_CLOSED);
551 } 551 }
552 552
553 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { 553 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) {
554 } 554 }
555 555
556 } // namespace net 556 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_network_transaction_spdy3_unittest.cc ('k') | net/spdy/spdy_proxy_client_socket_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698