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

Unified Diff: net/http/http_util.cc

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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_util.cc
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 77f498133bc606cf2d64e9020c25c4ac8b8e480d..0372f2147a56a5c6c08c822f57dad42f28d150f0 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -289,6 +289,27 @@ bool HttpUtil::ParseRangeHeader(const std::string& ranges_specifier,
}
// static
+std::string HttpUtil::PrintRanges(const std::vector<HttpByteRange>& ranges) {
+ DCHECK(!ranges.empty());
+
+ std::vector<std::string> printed_ranges;
+ printed_ranges.reserve(ranges.size());
+
+ for (std::vector<HttpByteRange>::const_iterator it = ranges.begin();
+ it != ranges.end();
+ ++it) {
+ printed_ranges.push_back(it->PrintInterval());
+ }
+
+ return "bytes=" + JoinString(printed_ranges, ',');
+}
+
+// static
+std::string HttpUtil::PrintRange(const HttpByteRange& range) {
+ return "bytes=" + range.PrintInterval();
+}
+
+// static
bool HttpUtil::HasHeader(const std::string& headers, const char* name) {
size_t name_len = strlen(name);
string::const_iterator it =
« net/http/http_util.h ('K') | « net/http/http_util.h ('k') | net/http/http_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698