summaryrefslogtreecommitdiffstats
path: root/net/http/http_util.h
diff options
context:
space:
mode:
authorttuttle <ttuttle@chromium.org>2014-11-06 14:38:47 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-06 22:39:06 +0000
commit324834655334ea4d12fc9eed14a838376c8a49f3 (patch)
treea3f35f8518357f1c292cfb2402e7d02083b72b9b /net/http/http_util.h
parent2d4bf3a9f724cfc78d43b6b247397ca76d39b3f4 (diff)
downloadchromium_src-324834655334ea4d12fc9eed14a838376c8a49f3.zip
chromium_src-324834655334ea4d12fc9eed14a838376c8a49f3.tar.gz
chromium_src-324834655334ea4d12fc9eed14a838376c8a49f3.tar.bz2
Extract Retry-After parsing from captive portal detector
R=*mmenke@chromium.org BUG= Review URL: https://codereview.chromium.org/700053005 Cr-Commit-Position: refs/heads/master@{#303103}
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r--net/http/http_util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h
index bde65dc..211e634 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/strings/string_tokenizer.h"
+#include "base/time/time.h"
#include "net/base/net_export.h"
#include "net/http/http_byte_range.h"
#include "net/http/http_version.h"
@@ -66,6 +67,15 @@ class NET_EXPORT HttpUtil {
static bool ParseRangeHeader(const std::string& range_specifier,
std::vector<HttpByteRange>* ranges);
+ // Parses a Retry-After header that is either an absolute date/time or a
+ // number of seconds in the future. Interprets absolute times as relative to
+ // |now|. If |retry_after_string| is successfully parsed and indicates a time
+ // that is not in the past, fills in |*retry_after| and returns true;
+ // otherwise, returns false.
+ static bool ParseRetryAfterHeader(const std::string& retry_after_string,
+ base::Time now,
+ base::TimeDelta* retry_after);
+
// 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