| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_tokenizer.h" | 10 #include "base/string_tokenizer.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "net/http/http_byte_range.h" | 12 #include "net/http/http_byte_range.h" |
| 13 | 13 |
| 14 // This is a macro to support extending this string literal at compile time. | 14 // This is a macro to support extending this string literal at compile time. |
| 15 // Please excuse me polluting your global namespace! | 15 // Please excuse me polluting your global namespace! |
| 16 #define HTTP_LWS " \t" | 16 #define HTTP_LWS " \t" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class HttpUtil { | 20 class HttpUtil { |
| 21 public: | 21 public: |
| 22 // Returns the absolute path of the URL, to be used for the http request. | 22 // Returns the absolute path of the URL, to be used for the http request. |
| 23 // The absolute path starts with a '/' and may contain a query. | 23 // The absolute path starts with a '/' and may contain a query. |
| 24 static std::string PathForRequest(const GURL& url); | 24 static std::string PathForRequest(const GURL& url); |
| 25 | 25 |
| 26 // Returns the absolute URL, to be used for the http request. This url is | 26 // Returns the absolute URL, to be used for the http request. This url is |
| 27 // made up of the protocol, host, [port], path, [query]. Everything else | 27 // made up of the protocol, host, [port], path, [query]. Everything else |
| 28 // is stripped (username, password, reference). | 28 // is stripped (username, password, reference). |
| 29 static std::string SpecForRequest(const GURL& url); | 29 static std::string SpecForRequest(const GURL& url); |
| 30 | 30 |
| 31 // Locates the next occurance of delimiter in line, skipping over quoted | 31 // Locates the next occurance of delimiter in line, skipping over quoted |
| 32 // strings (e.g., commas will not be treated as delimiters if they appear | 32 // strings (e.g., commas will not be treated as delimiters if they appear |
| 33 // within a quoted string). Returns the offset of the found delimiter or | 33 // within a quoted string). Returns the offset of the found delimiter or |
| 34 // line.size() if no delimiter was found. | 34 // line.size() if no delimiter was found. |
| 35 static size_t FindDelimiter(const std::string& line, | 35 static size_t FindDelimiter(const std::string& line, |
| 36 size_t search_start, | 36 size_t search_start, |
| 37 char delimiter); | 37 char delimiter); |
| 38 | 38 |
| 39 // Parses the value of a Content-Type header. The resulting mime_type and | 39 // Parses the value of a Content-Type header. The resulting mime_type and |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 private: | 244 private: |
| 245 StringTokenizer values_; | 245 StringTokenizer values_; |
| 246 std::string::const_iterator value_begin_; | 246 std::string::const_iterator value_begin_; |
| 247 std::string::const_iterator value_end_; | 247 std::string::const_iterator value_end_; |
| 248 }; | 248 }; |
| 249 }; | 249 }; |
| 250 | 250 |
| 251 } // namespace net | 251 } // namespace net |
| 252 | 252 |
| 253 #endif // NET_HTTP_HTTP_UTIL_H_ | 253 #endif // NET_HTTP_HTTP_UTIL_H_ |
| OLD | NEW |