OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/string_tokenizer.h" | 8 #include "base/string_tokenizer.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 static void ParseContentType(const std::string& content_type_str, | 40 static void ParseContentType(const std::string& content_type_str, |
41 std::string* mime_type, | 41 std::string* mime_type, |
42 std::string* charset, | 42 std::string* charset, |
43 bool *had_charset); | 43 bool *had_charset); |
44 | 44 |
45 // Scans the '\r\n'-delimited headers for the given header name. Returns | 45 // Scans the '\r\n'-delimited headers for the given header name. Returns |
46 // true if a match is found. Input is assumed to be well-formed. | 46 // true if a match is found. Input is assumed to be well-formed. |
47 // TODO(darin): kill this | 47 // TODO(darin): kill this |
48 static bool HasHeader(const std::string& headers, const char* name); | 48 static bool HasHeader(const std::string& headers, const char* name); |
49 | 49 |
| 50 // Strips all header lines from |headers| whose name matches |
| 51 // |headers_to_remove|. |headers_to_remove| is a list of null-terminated |
| 52 // lower-case header names, with array length |headers_to_remove_len|. |
| 53 // Returns the stripped header lines list, separated by "\r\n". |
| 54 static std::string StripHeaders(const std::string& headers, |
| 55 const char* const headers_to_remove[], |
| 56 size_t headers_to_remove_len); |
| 57 |
50 // Multiple occurances of some headers cannot be coalesced into a comma- | 58 // Multiple occurances of some headers cannot be coalesced into a comma- |
51 // separated list since their values are (or contain) unquoted HTTP-date | 59 // separated list since their values are (or contain) unquoted HTTP-date |
52 // values, which may contain a comma (see RFC 2616 section 3.3.1). | 60 // values, which may contain a comma (see RFC 2616 section 3.3.1). |
53 static bool IsNonCoalescingHeader(std::string::const_iterator name_begin, | 61 static bool IsNonCoalescingHeader(std::string::const_iterator name_begin, |
54 std::string::const_iterator name_end); | 62 std::string::const_iterator name_end); |
55 static bool IsNonCoalescingHeader(const std::string& name) { | 63 static bool IsNonCoalescingHeader(const std::string& name) { |
56 return IsNonCoalescingHeader(name.begin(), name.end()); | 64 return IsNonCoalescingHeader(name.begin(), name.end()); |
57 } | 65 } |
58 | 66 |
59 // Return true if the character is HTTP "linear white space" (SP | HT). | 67 // Return true if the character is HTTP "linear white space" (SP | HT). |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 private: | 209 private: |
202 StringTokenizer values_; | 210 StringTokenizer values_; |
203 std::string::const_iterator value_begin_; | 211 std::string::const_iterator value_begin_; |
204 std::string::const_iterator value_end_; | 212 std::string::const_iterator value_end_; |
205 }; | 213 }; |
206 }; | 214 }; |
207 | 215 |
208 } // namespace net | 216 } // namespace net |
209 | 217 |
210 #endif // NET_HTTP_HTTP_UTIL_H_ | 218 #endif // NET_HTTP_HTTP_UTIL_H_ |
OLD | NEW |