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

Side by Side Diff: net/tools/flip_server/spdy_interface.cc

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 2 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
« no previous file with comments | « net/spdy/spdy_test_utils.h ('k') | net/tools/flip_server/spdy_interface_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/flip_server/spdy_interface.h" 5 #include "net/tools/flip_server/spdy_interface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "net/spdy/spdy_framer.h" 10 #include "net/spdy/spdy_framer.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (url == headers.end() || method == headers.end() || 147 if (url == headers.end() || method == headers.end() ||
148 version == headers.end() || scheme == headers.end()) { 148 version == headers.end() || scheme == headers.end()) {
149 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: A mandatory header is " 149 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: A mandatory header is "
150 << "missing. Not creating stream"; 150 << "missing. Not creating stream";
151 return 0; 151 return 0;
152 } 152 }
153 // url->second here only ever seems to contain just the path. When this 153 // url->second here only ever seems to contain just the path. When this
154 // path contains a query string with a http:// in one of its values, 154 // path contains a query string with a http:// in one of its values,
155 // UrlUtilities::GetUrlPath will fail and always return a / breaking 155 // UrlUtilities::GetUrlPath will fail and always return a / breaking
156 // the request. GetUrlPath assumes the absolute URL is being passed in. 156 // the request. GetUrlPath assumes the absolute URL is being passed in.
157 path_string = UrlUtilities::GetUrlPath(url->second); 157 path_string = UrlUtilities::GetUrlPath(url->second.as_string());
158 host_string = UrlUtilities::GetUrlHost(url->second); 158 host_string = UrlUtilities::GetUrlHost(url->second.as_string());
159 version_string = version->second; 159 version_string = version->second.as_string();
160 } else { 160 } else {
161 method = headers.find(":method"); 161 method = headers.find(":method");
162 host = headers.find(":host"); 162 host = headers.find(":host");
163 path = headers.find(":path"); 163 path = headers.find(":path");
164 scheme = headers.find(":scheme"); 164 scheme = headers.find(":scheme");
165 if (method == headers.end() || host == headers.end() || 165 if (method == headers.end() || host == headers.end() ||
166 path == headers.end() || scheme == headers.end()) { 166 path == headers.end() || scheme == headers.end()) {
167 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: A mandatory header is " 167 VLOG(2) << ACCEPTOR_CLIENT_IDENT << "SpdySM: A mandatory header is "
168 << "missing. Not creating stream"; 168 << "missing. Not creating stream";
169 return 0; 169 return 0;
170 } 170 }
171 host_string = host->second; 171 host_string = host->second.as_string();
172 path_string = path->second; 172 path_string = path->second.as_string();
173 version_string = "HTTP/1.1"; 173 version_string = "HTTP/1.1";
174 } 174 }
175 175
176 if (scheme->second.compare("https") == 0) { 176 if (scheme->second.compare("https") == 0) {
177 *is_https_scheme = true; 177 *is_https_scheme = true;
178 } 178 }
179 179
180 if (acceptor_->flip_handler_type_ == FLIP_HANDLER_SPDY_SERVER) { 180 if (acceptor_->flip_handler_type_ == FLIP_HANDLER_SPDY_SERVER) {
181 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Request: " << method->second 181 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Request: " << method->second
182 << " " << path_string; 182 << " " << path_string;
183 std::string filename = EncodeURL(path_string, 183 std::string filename =
184 host_string, 184 EncodeURL(path_string, host_string, method->second.as_string());
185 method->second);
186 NewStream(stream_id, priority, filename); 185 NewStream(stream_id, priority, filename);
187 } else { 186 } else {
188 http_data += 187 http_data += method->second.as_string() + " " + path_string + " " +
189 method->second + " " + path_string + " " + version_string + "\r\n"; 188 version_string + "\r\n";
190 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Request: " << method->second << " " 189 VLOG(1) << ACCEPTOR_CLIENT_IDENT << "Request: " << method->second << " "
191 << path_string << " " << version_string; 190 << path_string << " " << version_string;
192 http_data += "Host: " + (*is_https_scheme ? 191 http_data += "Host: " + (*is_https_scheme ?
193 acceptor_->https_server_ip_ : 192 acceptor_->https_server_ip_ :
194 acceptor_->http_server_ip_) + "\r\n"; 193 acceptor_->http_server_ip_) + "\r\n";
195 for (SpdyHeaderBlock::const_iterator i = headers.begin(); 194 for (SpdyHeaderBlock::const_iterator i = headers.begin();
196 i != headers.end(); ++i) { 195 i != headers.end(); ++i) {
197 if ((i->first.size() > 0 && i->first[0] == ':') || 196 if ((i->first.size() > 0 && i->first[0] == ':') ||
198 i->first == "host" || 197 i->first == "host" ||
199 i == method || 198 i == method ||
200 i == host || 199 i == host ||
201 i == path || 200 i == path ||
202 i == scheme || 201 i == scheme ||
203 i == version || 202 i == version ||
204 i == url) { 203 i == url) {
205 // Ignore the entry. 204 // Ignore the entry.
206 } else { 205 } else {
207 http_data += i->first + ": " + i->second + "\r\n"; 206 http_data +=
208 VLOG(2) << ACCEPTOR_CLIENT_IDENT << i->first.c_str() << ":" 207 i->first.as_string() + ": " + i->second.as_string() + "\r\n";
209 << i->second.c_str(); 208 VLOG(2) << ACCEPTOR_CLIENT_IDENT << i->first << ":" << i->second;
210 } 209 }
211 } 210 }
212 if (forward_ip_header_.length()) { 211 if (forward_ip_header_.length()) {
213 // X-Client-Cluster-IP header 212 // X-Client-Cluster-IP header
214 http_data += forward_ip_header_ + ": " + 213 http_data += forward_ip_header_ + ": " +
215 connection_->client_ip() + "\r\n"; 214 connection_->client_ip() + "\r\n";
216 } 215 }
217 http_data += "\r\n"; 216 http_data += "\r\n";
218 } 217 }
219 218
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 627 }
629 } 628 }
630 629
631 void SpdySM::CreateFramer(SpdyMajorVersion spdy_version) { 630 void SpdySM::CreateFramer(SpdyMajorVersion spdy_version) {
632 DCHECK(!buffered_spdy_framer_); 631 DCHECK(!buffered_spdy_framer_);
633 buffered_spdy_framer_.reset(new BufferedSpdyFramer(spdy_version, true)); 632 buffered_spdy_framer_.reset(new BufferedSpdyFramer(spdy_version, true));
634 buffered_spdy_framer_->set_visitor(this); 633 buffered_spdy_framer_->set_visitor(this);
635 } 634 }
636 635
637 } // namespace net 636 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_utils.h ('k') | net/tools/flip_server/spdy_interface_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698