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

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

Issue 2651673004: Add quic_map_util. (Closed)
Patch Set: Created 3 years, 11 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/stl_util.h"
11 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
12 #include "net/quic/core/quic_spdy_stream.h" 11 #include "net/quic/core/quic_spdy_stream.h"
13 #include "net/quic/core/spdy_utils.h" 12 #include "net/quic/core/spdy_utils.h"
14 #include "net/quic/platform/api/quic_bug_tracker.h" 13 #include "net/quic/platform/api/quic_bug_tracker.h"
15 #include "net/quic/platform/api/quic_logging.h" 14 #include "net/quic/platform/api/quic_logging.h"
15 #include "net/quic/platform/api/quic_map_util.h"
16 #include "net/quic/platform/api/quic_text_utils.h" 16 #include "net/quic/platform/api/quic_text_utils.h"
17 #include "net/spdy/spdy_protocol.h" 17 #include "net/spdy/spdy_protocol.h"
18 #include "net/tools/quic/quic_http_response_cache.h" 18 #include "net/tools/quic/quic_http_response_cache.h"
19 #include "net/tools/quic/quic_simple_server_session.h" 19 #include "net/tools/quic/quic_simple_server_session.h"
20 20
21 using base::StringPiece; 21 using base::StringPiece;
22 using std::string; 22 using std::string;
23 23
24 namespace net { 24 namespace net {
25 25
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 if (content_length_ > 0 && 116 if (content_length_ > 0 &&
117 static_cast<uint64_t>(content_length_) != body_.size()) { 117 static_cast<uint64_t>(content_length_) != body_.size()) {
118 QUIC_DVLOG(1) << "Content length (" << content_length_ << ") != body size (" 118 QUIC_DVLOG(1) << "Content length (" << content_length_ << ") != body size ("
119 << body_.size() << ")."; 119 << body_.size() << ").";
120 SendErrorResponse(); 120 SendErrorResponse();
121 return; 121 return;
122 } 122 }
123 123
124 if (!base::ContainsKey(request_headers_, ":authority") || 124 if (!QuicContainsKey(request_headers_, ":authority") ||
125 !base::ContainsKey(request_headers_, ":path")) { 125 !QuicContainsKey(request_headers_, ":path")) {
126 QUIC_DVLOG(1) << "Request headers do not contain :authority or :path."; 126 QUIC_DVLOG(1) << "Request headers do not contain :authority or :path.";
127 SendErrorResponse(); 127 SendErrorResponse();
128 return; 128 return;
129 } 129 }
130 130
131 // Find response in cache. If not found, send error response. 131 // Find response in cache. If not found, send error response.
132 const QuicHttpResponseCache::Response* response = nullptr; 132 const QuicHttpResponseCache::Response* response = nullptr;
133 auto authority = request_headers_.find(":authority"); 133 auto authority = request_headers_.find(":authority");
134 auto path = request_headers_.find(":path"); 134 auto path = request_headers_.find(":path");
135 if (authority != request_headers_.end() && path != request_headers_.end()) { 135 if (authority != request_headers_.end() && path != request_headers_.end()) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 QUIC_DLOG(INFO) << "Writing trailers (fin = true): " 260 QUIC_DLOG(INFO) << "Writing trailers (fin = true): "
261 << response_trailers.DebugString(); 261 << response_trailers.DebugString();
262 WriteTrailers(std::move(response_trailers), nullptr); 262 WriteTrailers(std::move(response_trailers), nullptr);
263 } 263 }
264 264
265 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad"; 265 const char* const QuicSimpleServerStream::kErrorResponseBody = "bad";
266 const char* const QuicSimpleServerStream::kNotFoundResponseBody = 266 const char* const QuicSimpleServerStream::kNotFoundResponseBody =
267 "file not found"; 267 "file not found";
268 268
269 } // namespace net 269 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_http_response_cache_test.cc ('k') | net/tools/quic/quic_spdy_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698