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

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: 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
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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 string SpdyUtils::GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers) { 254 string SpdyUtils::GetHostNameFromHeaderBlock(const SpdyHeaderBlock& headers) {
255 return GURL(GetUrlFromHeaderBlock(headers)).host(); 255 return GURL(GetUrlFromHeaderBlock(headers)).host();
256 } 256 }
257 257
258 // static 258 // static
259 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) { 259 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) {
260 string url(GetUrlFromHeaderBlock(headers)); 260 string url(GetUrlFromHeaderBlock(headers));
261 return url != "" && GURL(url).is_valid(); 261 return url != "" && GURL(url).is_valid();
262 } 262 }
263 263
264 // static
265 bool SpdyUtils::PopulateHeaderBlockFromUrl(const string url,
266 SpdyHeaderBlock* headers) {
267 (*headers)[":method"] = "GET";
268 size_t pos = url.find("://");
269 if (pos == string::npos) {
270 return false;
271 }
272 (*headers)[":scheme"] = url.substr(0, pos);
273 size_t start = pos + 3;
274 pos = url.find("/", start);
275 if (pos == string::npos) {
276 return false;
277 }
278 (*headers)[":authority"] = url.substr(start, pos - start);
279 (*headers)[":path"] = url.substr(pos);
280 return true;
281 }
282
264 } // namespace net 283 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698