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 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // means q=1.0. | 169 // means q=1.0. |
170 // | 170 // |
171 // When making a http request, this should be used to determine what | 171 // When making a http request, this should be used to determine what |
172 // to put in Accept-Language header. If a comma separated list of language | 172 // to put in Accept-Language header. If a comma separated list of language |
173 // codes *without* qvalue is sent, web servers regard all | 173 // codes *without* qvalue is sent, web servers regard all |
174 // of them as having q=1.0 and pick one of them even though it may not | 174 // of them as having q=1.0 and pick one of them even though it may not |
175 // be at the beginning of the list (see http://crbug.com/5899). | 175 // be at the beginning of the list (see http://crbug.com/5899). |
176 static std::string GenerateAcceptLanguageHeader( | 176 static std::string GenerateAcceptLanguageHeader( |
177 const std::string& raw_language_list); | 177 const std::string& raw_language_list); |
178 | 178 |
179 // Given a charset, return the list with a qvalue. If charset is utf-8, | |
180 // it will return 'utf-8,*;q=0.5'. Otherwise (e.g. 'euc-jp'), it'll return | |
181 // 'euc-jp,utf-8;q=0.7,*;q=0.3'. | |
182 static std::string GenerateAcceptCharsetHeader(const std::string& charset); | |
183 | |
184 // Helper. If |*headers| already contains |header_name| do nothing, | 179 // Helper. If |*headers| already contains |header_name| do nothing, |
185 // otherwise add <header_name> ": " <header_value> to the end of the list. | 180 // otherwise add <header_name> ": " <header_value> to the end of the list. |
186 static void AppendHeaderIfMissing(const char* header_name, | 181 static void AppendHeaderIfMissing(const char* header_name, |
187 const std::string& header_value, | 182 const std::string& header_value, |
188 std::string* headers); | 183 std::string* headers); |
189 | 184 |
190 // Returns true if the parameters describe a response with a strong etag or | 185 // Returns true if the parameters describe a response with a strong etag or |
191 // last-modified header. See section 13.3.3 of RFC 2616. | 186 // last-modified header. See section 13.3.3 of RFC 2616. |
192 static bool HasStrongValidators(HttpVersion version, | 187 static bool HasStrongValidators(HttpVersion version, |
193 const std::string& etag_header, | 188 const std::string& etag_header, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // into the original's unquoted_value_ member. | 350 // into the original's unquoted_value_ member. |
356 std::string unquoted_value_; | 351 std::string unquoted_value_; |
357 | 352 |
358 bool value_is_quoted_; | 353 bool value_is_quoted_; |
359 }; | 354 }; |
360 }; | 355 }; |
361 | 356 |
362 } // namespace net | 357 } // namespace net |
363 | 358 |
364 #endif // NET_HTTP_HTTP_UTIL_H_ | 359 #endif // NET_HTTP_HTTP_UTIL_H_ |
OLD | NEW |