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

Side by Side Diff: net/http/http_util.h

Issue 425803014: Refactor pooling logic into a helper method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working Created 6 years, 4 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 | Annotate | Revision Log
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 #ifndef NET_HTTP_HTTP_UTIL_H_ 5 #ifndef NET_HTTP_HTTP_UTIL_H_
6 #define NET_HTTP_HTTP_UTIL_H_ 6 #define NET_HTTP_HTTP_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/strings/string_tokenizer.h" 12 #include "base/strings/string_tokenizer.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/http/http_byte_range.h" 14 #include "net/http/http_byte_range.h"
15 #include "net/http/http_version.h" 15 #include "net/http/http_version.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 17
18 // This is a macro to support extending this string literal at compile time. 18 // This is a macro to support extending this string literal at compile time.
19 // Please excuse me polluting your global namespace! 19 // Please excuse me polluting your global namespace!
20 #define HTTP_LWS " \t" 20 #define HTTP_LWS " \t"
21 21
22 namespace net { 22 namespace net {
23 23
24 class CertVerifyResult;
25 class SSLInfo;
26 class TransportSecurityState;
27
24 class NET_EXPORT HttpUtil { 28 class NET_EXPORT HttpUtil {
25 public: 29 public:
26 // Returns the absolute path of the URL, to be used for the http request. 30 // Returns the absolute path of the URL, to be used for the http request.
27 // The absolute path starts with a '/' and may contain a query. 31 // The absolute path starts with a '/' and may contain a query.
28 static std::string PathForRequest(const GURL& url); 32 static std::string PathForRequest(const GURL& url);
29 33
30 // Returns the absolute URL, to be used for the http request. This url is 34 // Returns the absolute URL, to be used for the http request. This url is
31 // made up of the protocol, host, [port], path, [query]. Everything else 35 // made up of the protocol, host, [port], path, [query]. Everything else
32 // is stripped (username, password, reference). 36 // is stripped (username, password, reference).
33 static std::string SpecForRequest(const GURL& url); 37 static std::string SpecForRequest(const GURL& url);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 195
192 // Gets a vector of common HTTP status codes for histograms of status 196 // Gets a vector of common HTTP status codes for histograms of status
193 // codes. Currently returns everything in the range [100, 600), plus 0 197 // codes. Currently returns everything in the range [100, 600), plus 0
194 // (for invalid responses/status codes). 198 // (for invalid responses/status codes).
195 static std::vector<int> GetStatusCodesForHistogram(); 199 static std::vector<int> GetStatusCodesForHistogram();
196 200
197 // Maps an HTTP status code to one of the status codes in the vector 201 // Maps an HTTP status code to one of the status codes in the vector
198 // returned by GetStatusCodesForHistogram. 202 // returned by GetStatusCodesForHistogram.
199 static int MapStatusCodeForHistogram(int code); 203 static int MapStatusCodeForHistogram(int code);
200 204
205 // Returns true if |hostname| can be pooled into an existing connection
206 // associated with |ssl_info|.
207 static bool CanPool(TransportSecurityState* transport_security_state,
208 const SSLInfo& ssl_info,
209 const std::string& old_hostname,
210 const std::string& new_hostname);
211
201 // Used to iterate over the name/value pairs of HTTP headers. To iterate 212 // Used to iterate over the name/value pairs of HTTP headers. To iterate
202 // over the values in a multi-value header, use ValuesIterator. 213 // over the values in a multi-value header, use ValuesIterator.
203 // See AssembleRawHeaders for joining line continuations (this iterator 214 // See AssembleRawHeaders for joining line continuations (this iterator
204 // does not expect any). 215 // does not expect any).
205 class NET_EXPORT HeadersIterator { 216 class NET_EXPORT HeadersIterator {
206 public: 217 public:
207 HeadersIterator(std::string::const_iterator headers_begin, 218 HeadersIterator(std::string::const_iterator headers_begin,
208 std::string::const_iterator headers_end, 219 std::string::const_iterator headers_end,
209 const std::string& line_delimiter); 220 const std::string& line_delimiter);
210 ~HeadersIterator(); 221 ~HeadersIterator();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // into the original's unquoted_value_ member. 361 // into the original's unquoted_value_ member.
351 std::string unquoted_value_; 362 std::string unquoted_value_;
352 363
353 bool value_is_quoted_; 364 bool value_is_quoted_;
354 }; 365 };
355 }; 366 };
356 367
357 } // namespace net 368 } // namespace net
358 369
359 #endif // NET_HTTP_HTTP_UTIL_H_ 370 #endif // NET_HTTP_HTTP_UTIL_H_
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_util.cc » ('j') | net/http/http_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698