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

Side by Side Diff: net/http/http_response_body_drainer.cc

Issue 1884943003: HttpStreamParser: Don't reuse sockets which receive unparsed data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed a bit too much, fix case with body Created 4 years, 7 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/http/http_response_body_drainer.h" 5 #include "net/http/http_response_body_drainer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void HttpResponseBodyDrainer::OnTimerFired() { 106 void HttpResponseBodyDrainer::OnTimerFired() {
107 Finish(ERR_TIMED_OUT); 107 Finish(ERR_TIMED_OUT);
108 } 108 }
109 109
110 void HttpResponseBodyDrainer::Finish(int result) { 110 void HttpResponseBodyDrainer::Finish(int result) {
111 DCHECK_NE(ERR_IO_PENDING, result); 111 DCHECK_NE(ERR_IO_PENDING, result);
112 112
113 if (session_) 113 if (session_)
114 session_->RemoveResponseDrainer(this); 114 session_->RemoveResponseDrainer(this);
115 115
116 if (result < 0) { 116 if (result < 0 || !stream_->CanReuseConnection()) {
117 stream_->Close(true /* no keep-alive */); 117 stream_->Close(true /* no keep-alive */);
118 } else { 118 } else {
119 DCHECK_EQ(OK, result); 119 DCHECK_EQ(OK, result);
120 stream_->Close(false /* keep-alive */); 120 stream_->Close(false /* keep-alive */);
121 } 121 }
122 122
123 delete this; 123 delete this;
124 } 124 }
125 125
126 } // namespace net 126 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698