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

Issue 173270: Implement RestartWithAuth for NewFtpTransaction. (Closed)

Created:
11 years, 4 months ago by Paweł Hajdan Jr.
Modified:
9 years, 7 months ago
Reviewers:
eroman, wtc
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Implement RestartWithAuth for NewFtpTransaction. TEST=Covered by net_unittests. http://crbug.com/20112 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=24449

Patch Set 1 #

Patch Set 2 : minor fixes #

Patch Set 3 : win compile fixes #

Total comments: 21
Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -37 lines) Patch
M net/ftp/ftp_network_transaction.h View 3 chunks +6 lines, -2 lines 1 comment Download
M net/ftp/ftp_network_transaction.cc View 11 chunks +49 lines, -25 lines 7 comments Download
M net/ftp/ftp_response_info.h View 1 1 chunk +6 lines, -5 lines 3 comments Download
M net/ftp/ftp_transaction.h View 1 chunk +2 lines, -1 line 0 comments Download
M net/url_request/url_request_new_ftp_job.h View 3 chunks +9 lines, -2 lines 1 comment Download
M net/url_request/url_request_new_ftp_job.cc View 5 chunks +73 lines, -2 lines 8 comments Download
M net/url_request/url_request_unittest.cc View 2 chunks +54 lines, -0 lines 1 comment Download

Messages

Total messages: 4 (0 generated)
Paweł Hajdan Jr.
This patch still doesn't use FtpAuthCache, but I plan to do that in a later ...
11 years, 4 months ago (2009-08-24 16:26:18 UTC) #1
Paweł Hajdan Jr.
ping
11 years, 3 months ago (2009-08-25 15:27:11 UTC) #2
wtc
LGTM. I compared your new code with the equivalent code in URLRequestFtpJob/URLRequestInetJob and URLRequestHttpJob carefully. ...
11 years, 3 months ago (2009-08-25 20:52:50 UTC) #3
eroman
11 years, 3 months ago (2009-09-01 07:12:37 UTC) #4
http://codereview.chromium.org/173270/diff/1007/16
File net/ftp/ftp_network_transaction.cc (right):

http://codereview.chromium.org/173270/diff/1007/16#newcode60
Line 60: username_ = UTF8ToWide(request_->url.username());
On 2009/08/25 20:52:50, wtc wrote:
> Please ask Darin and Brett whether the embedded username
> and password in URLs are ASCII or UTF-8, and whether they
> need to be unescaped.

They definitely do need to be unescaped.

See HttpNetworkTransaction::GetIdentifyFromUrl(), where we do the unescaping for
use by HTTP auth.

I suggest moving that method and its associated unittest to net_util, and
re-using it in FTP code.

As a side-note, I mis-spelled that function. It should read GetIdentityFromURL()
and not GetIdentifyFromUrl()!

http://codereview.chromium.org/173270/diff/1007/16#newcode61
Line 61: if (request_->url.has_password())
Don't actually need the guard, will just be empty string if there is none.

http://codereview.chromium.org/173270/diff/1007/16#newcode556
Line 556: std::string command = "PASS " + WideToUTF8(password_);
PLEASE READ: This looks dangerous!

|username_| and |password_| must be sanitized after extracting them from the
URL, being very careful to strip away CR and LF... since those could be used to
escape the current command and issue other things, like deleting files.

ALSO, note that the RFC for FTP makes no mention of UTF8.
The username and password are expected to be ASCII, so you should do a lossy
conversion here from wide to ASCII :(

http://codereview.chromium.org/173270/diff/1007/16#newcode579
Line 579: response_.auth_needed = true;
Hm, I dont know about this... will have to look more closely. My first reaction
is there are other error codes not covered by this which relate to login (530,
331, 332).

Powered by Google App Engine
This is Rietveld 408576698