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/quic/http_request_line.cc

Issue 337093003: QuicServer: Use Chrome's header parsing rather than Balsa (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quic_server_3
Patch Set: (mark StringPieceUtils as copied, not added) Created 6 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/quic/http_request_line.h"
6 #include "net/quic/string_piece_utils.h"
7
8 using std::string;
9 using base::StringPiece;
10 using net::StringPieceUtils;
11 using net::SpdyHeaderBlock;
12
13 HttpRequestLine::HttpRequestLine(StringPiece method,
Ryan Hamilton 2014/06/19 00:15:44 I agree that HttpRequestInfo does not add a ton of
dmz 2014/06/19 21:17:02 You're right, I think I had seen only HttpRequestH
14 StringPiece path,
15 StringPiece version,
16 StringPiece host)
17 : method_(method.as_string()),
18 path_(path.as_string()),
19 version_(version.as_string()),
20 host_(host.as_string()) {
21 }
22
23 HttpRequestLine::~HttpRequestLine() {
24 }
25
26 // static
27 HttpRequestLine* HttpRequestLine::FromSpdyHeaders(
28 const SpdyHeaderBlock& headers) {
29 typedef SpdyHeaderBlock::const_iterator BlockIt;
30
31 BlockIt host_it = headers.find(":host");
32 BlockIt path_it = headers.find(":path");
33 BlockIt method_it = headers.find(":method");
34 BlockIt end_it = headers.end();
35 if (host_it == end_it || path_it == end_it || method_it == end_it) {
36 return NULL;
37 }
38 return new HttpRequestLine(method_it->second,
39 path_it->second,
40 "HTTP/1.1",
41 host_it->second);
42 }
43
44 string HttpRequestLine::FullPath() const {
45 StringPiece uri = path_;
46 if (uri.size() == 0) {
47 return "";
48 }
49 StringPiece host;
50 if (uri[0] == '/') {
51 host = host_;
52 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "https://")) {
53 uri.remove_prefix(8);
54 } else if (StringPieceUtils::StartsWithIgnoreCase(uri, "http://")) {
55 uri.remove_prefix(7);
56 }
57 return host.as_string() + uri.as_string();
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698