| Index: net/url_request/url_request_ftp_job.cc
|
| diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
|
| index e422d036597461d138b6e9bc06ae38c841e70962..3a088bd87c9f4ef5de66a333efb14f691d6254cd 100644
|
| --- a/net/url_request/url_request_ftp_job.cc
|
| +++ b/net/url_request/url_request_ftp_job.cc
|
| @@ -239,7 +239,7 @@ void URLRequestFtpJob::OnStartCompleted(int result) {
|
| HandleAuthNeededResponse();
|
| return;
|
| } else {
|
| - NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
|
| + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
|
| }
|
| }
|
|
|
| @@ -251,7 +251,15 @@ void URLRequestFtpJob::OnStartCompletedAsync(int result) {
|
|
|
| void URLRequestFtpJob::OnReadCompleted(int result) {
|
| read_in_progress_ = false;
|
| - ReadRawDataComplete(result);
|
| + if (result == 0) {
|
| + NotifyDone(URLRequestStatus());
|
| + } else if (result < 0) {
|
| + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, result));
|
| + } else {
|
| + // Clear the IO_PENDING status
|
| + SetStatus(URLRequestStatus());
|
| + }
|
| + NotifyReadComplete(result);
|
| }
|
|
|
| void URLRequestFtpJob::RestartTransactionWithAuth() {
|
| @@ -344,12 +352,14 @@ UploadProgress URLRequestFtpJob::GetUploadProgress() const {
|
| return UploadProgress();
|
| }
|
|
|
| -int URLRequestFtpJob::ReadRawData(IOBuffer* buf, int buf_size) {
|
| +bool URLRequestFtpJob::ReadRawData(IOBuffer* buf,
|
| + int buf_size,
|
| + int* bytes_read) {
|
| DCHECK_NE(buf_size, 0);
|
| + DCHECK(bytes_read);
|
| DCHECK(!read_in_progress_);
|
|
|
| int rv;
|
| -
|
| if (proxy_info_.is_direct()) {
|
| rv = ftp_transaction_->Read(buf, buf_size,
|
| base::Bind(&URLRequestFtpJob::OnReadCompleted,
|
| @@ -360,9 +370,18 @@ int URLRequestFtpJob::ReadRawData(IOBuffer* buf, int buf_size) {
|
| base::Unretained(this)));
|
| }
|
|
|
| - if (rv == ERR_IO_PENDING)
|
| + if (rv >= 0) {
|
| + *bytes_read = rv;
|
| + return true;
|
| + }
|
| +
|
| + if (rv == ERR_IO_PENDING) {
|
| read_in_progress_ = true;
|
| - return rv;
|
| + SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
|
| + } else {
|
| + NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
|
| + }
|
| + return false;
|
| }
|
|
|
| void URLRequestFtpJob::HandleAuthNeededResponse() {
|
|
|