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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 static void ParseContentType(const std::string& content_type_str, | 49 static void ParseContentType(const std::string& content_type_str, |
50 std::string* mime_type, | 50 std::string* mime_type, |
51 std::string* charset, | 51 std::string* charset, |
52 bool* had_charset, | 52 bool* had_charset, |
53 std::string* boundary); | 53 std::string* boundary); |
54 | 54 |
55 // Scans the headers and look for the first "Range" header in |headers|, | 55 // Scans the headers and look for the first "Range" header in |headers|, |
56 // if "Range" exists and the first one of it is well formatted then returns | 56 // if "Range" exists and the first one of it is well formatted then returns |
57 // true, |ranges| will contain a list of valid ranges. If return | 57 // true, |ranges| will contain a list of valid ranges. If return |
58 // value is false then values in |ranges| should not be used. The format of | 58 // value is false then values in |ranges| should not be used. The format of |
59 // "Range" header is defined in RFC 2616 Section 14.35.1. | 59 // "Range" header is defined in RFC 7233 Section 2.1. |
60 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 | 60 // https://tools.ietf.org/html/rfc7233#section-2.1 |
61 static bool ParseRanges(const std::string& headers, | 61 static bool ParseRanges(const std::string& headers, |
62 std::vector<HttpByteRange>* ranges); | 62 std::vector<HttpByteRange>* ranges); |
63 | 63 |
64 // Same thing as ParseRanges except the Range header is known and its value | 64 // Same thing as ParseRanges except the Range header is known and its value |
65 // is directly passed in, rather than requiring searching through a string. | 65 // is directly passed in, rather than requiring searching through a string. |
66 static bool ParseRangeHeader(const std::string& range_specifier, | 66 static bool ParseRangeHeader(const std::string& range_specifier, |
67 std::vector<HttpByteRange>* ranges); | 67 std::vector<HttpByteRange>* ranges); |
68 | 68 |
69 // Scans the '\r\n'-delimited headers for the given header name. Returns | 69 // Scans the '\r\n'-delimited headers for the given header name. Returns |
70 // true if a match is found. Input is assumed to be well-formed. | 70 // true if a match is found. Input is assumed to be well-formed. |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // into the original's unquoted_value_ member. | 350 // into the original's unquoted_value_ member. |
351 std::string unquoted_value_; | 351 std::string unquoted_value_; |
352 | 352 |
353 bool value_is_quoted_; | 353 bool value_is_quoted_; |
354 }; | 354 }; |
355 }; | 355 }; |
356 | 356 |
357 } // namespace net | 357 } // namespace net |
358 | 358 |
359 #endif // NET_HTTP_HTTP_UTIL_H_ | 359 #endif // NET_HTTP_HTTP_UTIL_H_ |
OLD | NEW |