summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 23:30:26 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-31 23:30:26 +0000
commit4ac7e43107e67a7a3b534b5efe9e7791378594f1 (patch)
treefea97662c22d0559b1fb9ef1cc8997a475ce3c26 /net/url_request
parenta287cc480eff74f26d8a3b61e7db432ad42d84dd (diff)
downloadchromium_src-4ac7e43107e67a7a3b534b5efe9e7791378594f1.zip
chromium_src-4ac7e43107e67a7a3b534b5efe9e7791378594f1.tar.gz
chromium_src-4ac7e43107e67a7a3b534b5efe9e7791378594f1.tar.bz2
Fix a hang if directory listing size is > 8K, for example,
ftp://ftp.mozilla.org/pub/addons/ The problem is that data was spooling on network stack and after 8K data TCP Window size becomes small and no more data is received after 8K. The fix is to change the ERROR_CLASS_INITIATED case in the ProcessResponseLIST function to not go back to the STATE_CTRL_READ state. In URLRequestNewFtpJob::ProcessFtpDir. construct the std::string from buf->data() and its length so that buf->data() doesn't need to be null-terminated. Author: Ibrar Ahmed <ibrar.ahmad@gmail.com> Original review: http://codereview.chromium.org/146137 R=wtc,phajdan.jr BUG=http://crbug.com/4965 TEST=ftp://ftp.mozilla.org/pub/addons/ Review URL: http://codereview.chromium.org/159663 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_new_ftp_job.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/url_request/url_request_new_ftp_job.cc b/net/url_request/url_request_new_ftp_job.cc
index 13d6d9e..fd34945 100644
--- a/net/url_request/url_request_new_ftp_job.cc
+++ b/net/url_request/url_request_new_ftp_job.cc
@@ -180,7 +180,6 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf,
int bytes_read) {
std::string file_entry;
std::string line;
- buf->data()[bytes_read] = 0;
// If all we've seen so far is ASCII, encoding_ is empty. Try to detect the
// encoding. We don't do the separate UTF-8 check here because the encoding
@@ -196,7 +195,7 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf,
encoding_ = DetectEncoding(buf->data(), bytes_read);
int64 file_size;
- std::istringstream iss(buf->data());
+ std::istringstream iss(std::string(buf->data(), bytes_read));
while (getline(iss, line)) {
struct net::ListState state;
struct net::ListResult result;