OLD | NEW |
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 "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 #include "net/http/http_byte_range.h" | 15 #include "net/http/http_byte_range.h" |
16 #include "net/http/http_version.h" | 16 #include "net/http/http_version.h" |
17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 // This is a macro to support extending this string literal at compile time. | 19 // This is a macro to support extending this string literal at compile time. |
20 // Please excuse me polluting your global namespace! | 20 // Please excuse me polluting your global namespace! |
21 #define HTTP_LWS " \t" | 21 #define HTTP_LWS " \t" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class NET_EXPORT HttpUtil { | 25 class NET_EXPORT HttpUtil { |
26 public: | 26 public: |
27 // Returns the absolute path of the URL, to be used for the http request. | |
28 // The absolute path starts with a '/' and may contain a query. | |
29 static std::string PathForRequest(const GURL& url); | |
30 | |
31 // Returns the absolute URL, to be used for the http request. This url is | 27 // Returns the absolute URL, to be used for the http request. This url is |
32 // made up of the protocol, host, [port], path, [query]. Everything else | 28 // made up of the protocol, host, [port], path, [query]. Everything else |
33 // is stripped (username, password, reference). | 29 // is stripped (username, password, reference). |
34 static std::string SpecForRequest(const GURL& url); | 30 static std::string SpecForRequest(const GURL& url); |
35 | 31 |
36 // Locates the next occurance of delimiter in line, skipping over quoted | 32 // Locates the next occurance of delimiter in line, skipping over quoted |
37 // strings (e.g., commas will not be treated as delimiters if they appear | 33 // strings (e.g., commas will not be treated as delimiters if they appear |
38 // within a quoted string). Returns the offset of the found delimiter or | 34 // within a quoted string). Returns the offset of the found delimiter or |
39 // line.size() if no delimiter was found. | 35 // line.size() if no delimiter was found. |
40 static size_t FindDelimiter(const std::string& line, | 36 static size_t FindDelimiter(const std::string& line, |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // into the original's unquoted_value_ member. | 363 // into the original's unquoted_value_ member. |
368 std::string unquoted_value_; | 364 std::string unquoted_value_; |
369 | 365 |
370 bool value_is_quoted_; | 366 bool value_is_quoted_; |
371 }; | 367 }; |
372 }; | 368 }; |
373 | 369 |
374 } // namespace net | 370 } // namespace net |
375 | 371 |
376 #endif // NET_HTTP_HTTP_UTIL_H_ | 372 #endif // NET_HTTP_HTTP_UTIL_H_ |
OLD | NEW |