diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-28 21:23:39 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-28 21:23:39 +0000 |
commit | fc48db85fecb5889fbfc5de5c9b8951dce547546 (patch) | |
tree | d7a0e01a06404219af4c05da4a2833ed9072859e /net/http/http_util.h | |
parent | 4684b1223a711baa9b4e37996c797600060b6f2e (diff) | |
download | chromium_src-fc48db85fecb5889fbfc5de5c9b8951dce547546.zip chromium_src-fc48db85fecb5889fbfc5de5c9b8951dce547546.tar.gz chromium_src-fc48db85fecb5889fbfc5de5c9b8951dce547546.tar.bz2 |
Implement a parser that parses the "Range" HTTP header
Parses "Range" HTTP request header so this request information
can be used in URLRequestFileJob and HttpCache.
Review URL: http://codereview.chromium.org/92006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r-- | net/http/http_util.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h index ade6241..ad7e671 100644 --- a/net/http/http_util.h +++ b/net/http/http_util.h @@ -1,12 +1,15 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_HTTP_HTTP_UTIL_H_ #define NET_HTTP_HTTP_UTIL_H_ +#include <vector> + #include "base/string_tokenizer.h" #include "googleurl/src/gurl.h" +#include "net/http/http_byte_range.h" // This is a macro to support extending this string literal at compile time. // Please excuse me polluting your global namespace! @@ -42,6 +45,15 @@ class HttpUtil { std::string* charset, bool *had_charset); + // Scans the headers and look for the first "Range" header in |headers|, + // if "Range" exists and the first one of it is well formatted then returns + // true, |ranges| will contain a list of valid ranges. If return + // value is false then values in |ranges| should not be used. The format of + // "Range" header is defined in RFC 2616 Section 14.35.1. + // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1 + static bool ParseRanges(const std::string& headers, + std::vector<HttpByteRange>* ranges); + // Scans the '\r\n'-delimited headers for the given header name. Returns // true if a match is found. Input is assumed to be well-formed. // TODO(darin): kill this |