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

Side by Side Diff: net/quic/core/spdy_utils.cc

Issue 2363393004: Remove usage of BalsaHeaders from QuicClient. Also move QuicDataToResend from QuicClient to QuicCli… (Closed)
Patch Set: Fix win Created 4 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/quic/core/spdy_utils.h ('k') | net/quic/core/spdy_utils_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/quic/core/spdy_utils.h" 5 #include "net/quic/core/spdy_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 string SpdyUtils::GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers) { 235 string SpdyUtils::GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers) {
236 return GURL(GetUrlFromHeaderBlock(headers)).host(); 236 return GURL(GetUrlFromHeaderBlock(headers)).host();
237 } 237 }
238 238
239 // static 239 // static
240 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) { 240 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) {
241 string url(GetUrlFromHeaderBlock(headers)); 241 string url(GetUrlFromHeaderBlock(headers));
242 return url != "" && GURL(url).is_valid(); 242 return url != "" && GURL(url).is_valid();
243 } 243 }
244 244
245 // static
246 bool SpdyUtils::PopulateHeaderBlockFromUrl(const string url,
247 SpdyHeaderBlock* headers) {
248 (*headers)[":method"] = "GET";
249 size_t pos = url.find("://");
250 if (pos == string::npos) {
251 return false;
252 }
253 (*headers)[":scheme"] = url.substr(0, pos);
254 size_t start = pos + 3;
255 pos = url.find("/", start);
256 if (pos == string::npos) {
257 return false;
258 }
259 (*headers)[":authority"] = url.substr(start, pos - start);
260 (*headers)[":path"] = url.substr(pos);
261 return true;
262 }
263
245 } // namespace net 264 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/spdy_utils.h ('k') | net/quic/core/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698