Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: net/http/http_util.h

Issue 78343004: Net: Standardize HttpByteRange printing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_byte_range_unittest.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // "Range" header is defined in RFC 2616 Section 14.35.1. 59 // "Range" header is defined in RFC 2616 Section 14.35.1.
60 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 60 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.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 // Prints the ranges in the standard HTTP form, e.g. "bytes=0-10,300-400,-40".
70 // |ranges| must contain one or more elements. All elements must be valid.
71 static std::string PrintRanges(const std::vector<HttpByteRange>& ranges);
72
73 // Prints the range header a single range. Assumes a valid |range|.
74 static std::string PrintRange(const HttpByteRange& range);
cbentzel 2013/11/22 16:24:35 Remove PrintRanges and place it in the only test f
75
69 // Scans the '\r\n'-delimited headers for the given header name. Returns 76 // 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. 77 // true if a match is found. Input is assumed to be well-formed.
71 // TODO(darin): kill this 78 // TODO(darin): kill this
72 static bool HasHeader(const std::string& headers, const char* name); 79 static bool HasHeader(const std::string& headers, const char* name);
73 80
74 // Returns true if it is safe to allow users and scripts to specify the header 81 // Returns true if it is safe to allow users and scripts to specify the header
75 // named |name|. 82 // named |name|.
76 static bool IsSafeHeader(const std::string& name); 83 static bool IsSafeHeader(const std::string& name);
77 84
78 // Strips all header lines from |headers| whose name matches 85 // Strips all header lines from |headers| whose name matches
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // into the original's unquoted_value_ member. 357 // into the original's unquoted_value_ member.
351 std::string unquoted_value_; 358 std::string unquoted_value_;
352 359
353 bool value_is_quoted_; 360 bool value_is_quoted_;
354 }; 361 };
355 }; 362 };
356 363
357 } // namespace net 364 } // namespace net
358 365
359 #endif // NET_HTTP_HTTP_UTIL_H_ 366 #endif // NET_HTTP_HTTP_UTIL_H_
OLDNEW
« no previous file with comments | « net/http/http_byte_range_unittest.cc ('k') | net/http/http_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698