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

Side by Side Diff: net/tools/quic/quic_simple_server_stream.cc

Issue 2102253003: Make SpdyHeaderBlock non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iOS fix. 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/tools/quic/quic_simple_server_stream.h" 5 #include "net/tools/quic/quic_simple_server_stream.h"
6 6
7 #include <list> 7 #include <list>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SendResponse(); 120 SendResponse();
121 } 121 }
122 122
123 void QuicSimpleServerStream::PushResponse( 123 void QuicSimpleServerStream::PushResponse(
124 SpdyHeaderBlock push_request_headers) { 124 SpdyHeaderBlock push_request_headers) {
125 if (id() % 2 != 0) { 125 if (id() % 2 != 0) {
126 QUIC_BUG << "Client initiated stream shouldn't be used as promised stream."; 126 QUIC_BUG << "Client initiated stream shouldn't be used as promised stream.";
127 return; 127 return;
128 } 128 }
129 // Change the stream state to emulate a client request. 129 // Change the stream state to emulate a client request.
130 request_headers_ = push_request_headers; 130 request_headers_ = std::move(push_request_headers);
131 content_length_ = 0; 131 content_length_ = 0;
132 DVLOG(1) << "Stream " << id() << ": Ready to receive server push response."; 132 DVLOG(1) << "Stream " << id() << ": Ready to receive server push response.";
133 133
134 // Set as if stream decompresed the headers and received fin. 134 // Set as if stream decompresed the headers and received fin.
135 QuicSpdyStream::OnInitialHeadersComplete(/*fin=*/true, 0); 135 QuicSpdyStream::OnInitialHeadersComplete(/*fin=*/true, 0);
136 } 136 }
137 137
138 void QuicSimpleServerStream::SendResponse() { 138 void QuicSimpleServerStream::SendResponse() {
139 if (!ContainsKey(request_headers_, ":authority") || 139 if (!ContainsKey(request_headers_, ":authority") ||
140 !ContainsKey(request_headers_, ":path")) { 140 !ContainsKey(request_headers_, ":path")) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 << id(); 196 << id();
197 197
198 if (!resources.empty()) { 198 if (!resources.empty()) {
199 QuicSimpleServerSession* session = 199 QuicSimpleServerSession* session =
200 static_cast<QuicSimpleServerSession*>(spdy_session()); 200 static_cast<QuicSimpleServerSession*>(spdy_session());
201 session->PromisePushResources(request_url, resources, id(), 201 session->PromisePushResources(request_url, resources, id(),
202 request_headers_); 202 request_headers_);
203 } 203 }
204 204
205 DVLOG(1) << "Sending response for stream " << id(); 205 DVLOG(1) << "Sending response for stream " << id();
206 SendHeadersAndBodyAndTrailers(response->headers(), response->body(), 206 SendHeadersAndBodyAndTrailers(response->headers().Clone(), response->body(),
207 response->trailers()); 207 response->trailers().Clone());
208 } 208 }
209 209
210 void QuicSimpleServerStream::SendNotFoundResponse() { 210 void QuicSimpleServerStream::SendNotFoundResponse() {
211 DVLOG(1) << "Sending not found response for stream " << id(); 211 DVLOG(1) << "Sending not found response for stream " << id();
212 SpdyHeaderBlock headers; 212 SpdyHeaderBlock headers;
213 headers[":status"] = "404"; 213 headers[":status"] = "404";
214 headers["content-length"] = base::IntToString(strlen(kNotFoundResponseBody)); 214 headers["content-length"] = base::IntToString(strlen(kNotFoundResponseBody));
215 SendHeadersAndBody(std::move(headers), kNotFoundResponseBody); 215 SendHeadersAndBody(std::move(headers), kNotFoundResponseBody);
216 } 216 }
217 217
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 DVLOG(1) << "Writing trailers (fin = true): " 264 DVLOG(1) << "Writing trailers (fin = true): "
265 << response_trailers.DebugString(); 265 << response_trailers.DebugString();
266 WriteTrailers(std::move(response_trailers), nullptr); 266 WriteTrailers(std::move(response_trailers), nullptr);
267 } 267 }
268 268
269 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; 269 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad";
270 const char* const QuicSimpleServerStream::kNotFoundResponseBody = 270 const char* const QuicSimpleServerStream::kNotFoundResponseBody =
271 "file not found"; 271 "file not found";
272 272
273 } // namespace net 273 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_session_test.cc ('k') | net/tools/quic/quic_simple_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698