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

Unified Diff: net/http/http_util.h

Issue 187583002: Cleanup: have common HttpResponseHeaders routine to update with range (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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
« no previous file with comments | « no previous file | net/http/http_util.cc » ('j') | net/http/http_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util.h
diff --git a/net/http/http_util.h b/net/http/http_util.h
index ae65146e6e4a42a21f673787d037f06330c9eb0b..a48405012c6eebb6e2ba359f0efc6d5df3ad6c19 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -21,6 +21,8 @@
namespace net {
+class HttpResponseHeaders;
+
class NET_EXPORT HttpUtil {
public:
// Returns the absolute path of the URL, to be used for the http request.
@@ -66,6 +68,17 @@ class NET_EXPORT HttpUtil {
static bool ParseRangeHeader(const std::string& range_specifier,
std::vector<HttpByteRange>* ranges);
+ // Updates Content-Length and Content-Range headers in the |headers|
rvargas (doing something else) 2014/03/05 19:47:33 tiny nit: go as close to 80 columns as possible.
kinuko 2014/03/06 04:11:29 Done.
+ // to include the right content length and range for |byte_range|.
+ // This also updates HTTP status line if |replace_status_line| is true.
+ // |byte_range| must be valid, otherwise this returns false and does
+ // not update |headers|.
+ static bool UpdateResponseHeadersWithRange(
rvargas (doing something else) 2014/03/05 19:47:33 Did you consider making this a member of ResponseH
kinuko 2014/03/06 04:11:29 Makes sense, I was worried that no other http util
+ const HttpByteRange& byte_range,
+ int64 resource_size,
+ bool replace_status_line,
+ HttpResponseHeaders* headers);
+
// 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
« no previous file with comments | « no previous file | net/http/http_util.cc » ('j') | net/http/http_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698