summaryrefslogtreecommitdiffstats
path: root/net/http/http_util.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 18:08:50 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 18:08:50 +0000
commit0b0bf036e2c2722b5d31162ad620b450763fa352 (patch)
treebbeeb3eaaa34df96d3f947d63280a93746837536 /net/http/http_util.h
parent78859c7d87db4433d068533b104c7c1addf7e7eb (diff)
downloadchromium_src-0b0bf036e2c2722b5d31162ad620b450763fa352.zip
chromium_src-0b0bf036e2c2722b5d31162ad620b450763fa352.tar.gz
chromium_src-0b0bf036e2c2722b5d31162ad620b450763fa352.tar.bz2
Reland r59910 - Add HttpResponseBodyDrainer. Use it for unfinished HttpStreams."
There's one simple fix. wtc had asked me to increment the buffer so we keep reading into new memory while draining the body. So I added |total_read_| to |read_buf_|. The problem is |read_buf_| is an IOBuffer*, not a char*, so I'm causing us to read into raw heap memory. Crashes ensue. My unit tests didn't catch it because they never actually read data. I've fixed that by doing a memset(). I've fixed the problem by not bothering to increment the read index, since that would require throwing away IOBuffers or some intrusive modifications to IOBuffer. BUG=54277 TEST=HttpResponseBodyDrainerTest.* Also see the manual testing instructions in r59910. Review URL: http://codereview.chromium.org/3449014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util.h')
-rw-r--r--net/http/http_util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 33da33d..3179782 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -10,6 +10,7 @@
#include "base/string_tokenizer.h"
#include "googleurl/src/gurl.h"
+#include "net/base/completion_callback.h"
#include "net/http/http_byte_range.h"
// This is a macro to support extending this string literal at compile time.
@@ -18,6 +19,8 @@
namespace net {
+class HttpStream;
+
class HttpUtil {
public:
// Returns the absolute path of the URL, to be used for the http request.
@@ -247,6 +250,10 @@ class HttpUtil {
std::string::const_iterator value_begin_;
std::string::const_iterator value_end_;
};
+
+ // Attempts to read all of the response body of |stream|. Closes |stream| and
+ // deletes it when complete.
+ static void DrainStreamBodyAndClose(HttpStream* stream);
};
} // namespace net