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

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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 const SpdyHeaderBlock& response, 466 const SpdyHeaderBlock& response,
467 base::Time response_time, 467 base::Time response_time,
468 int status) { 468 int status) {
469 // If we've already received the reply, existing headers are too late. 469 // If we've already received the reply, existing headers are too late.
470 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the 470 // TODO(mbelshe): figure out a way to make HEADERS frames useful after the
471 // initial response. 471 // initial response.
472 if (next_state_ != STATE_READ_REPLY_COMPLETE) 472 if (next_state_ != STATE_READ_REPLY_COMPLETE)
473 return OK; 473 return OK;
474 474
475 // Save the response 475 // Save the response
476 int rv = SpdyHeadersToHttpResponse(response, &response_); 476 if (!SpdyHeadersToHttpResponse(
477 if (rv == ERR_INCOMPLETE_SPDY_HEADERS) 477 response, spdy_stream_->GetProtocolVersion(), &response_))
478 return rv; // More headers are coming. 478 return ERR_INCOMPLETE_SPDY_HEADERS;
ramant (doing other things) 2012/03/30 22:19:58 Good catch.
Ryan Hamilton 2012/03/30 22:46:02 Thanks! I managed to hit the bug when I had this
479 479
480 OnIOComplete(status); 480 OnIOComplete(status);
481 return OK; 481 return OK;
482 } 482 }
483 483
484 // Called when data is received. 484 // Called when data is received.
485 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { 485 void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) {
486 if (length > 0) { 486 if (length > 0) {
487 // Save the received data. 487 // Save the received data.
488 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); 488 scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 // This may have been deleted by read_callback_, so check first. 549 // This may have been deleted by read_callback_, so check first.
550 if (weak_ptr && !write_callback.is_null()) 550 if (weak_ptr && !write_callback.is_null())
551 write_callback.Run(ERR_CONNECTION_CLOSED); 551 write_callback.Run(ERR_CONNECTION_CLOSED);
552 } 552 }
553 553
554 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) { 554 void SpdyProxyClientSocket::set_chunk_callback(ChunkCallback* /*callback*/) {
555 } 555 }
556 556
557 } // namespace net 557 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698