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

Issue 1574034: Changes FormatURL to not strip http if the host starts with ftp or https[!a-z]. This... (Closed)

Created:
10 years, 8 months ago by sky
Modified:
9 years, 7 months ago
Reviewers:
Peter Kasting
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Changes FormatURL to not strip http if the host starts with ftp or https[!a-z]. This is necessitated by the omnibox treating ftp.www.com as ftp://www.com as well as security problems. I also changed FormatURL to always reset the supplied url_parse::Parsed. I did this as in writing my test I uncovered a long standing bug where a component wasn't getting reset. It seems much safer to always reset than rely on all code paths setting every component. BUG=41585, 41652 TEST=make sure the omnibox doesn't strip http off urls that start with ftp. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=44943

Patch Set 1 #

Total comments: 1

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 7

Patch Set 4 : '' #

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -2 lines) Patch
M net/base/net_util.cc View 2 3 4 2 chunks +15 lines, -2 lines 0 comments Download
M net/base/net_util_unittest.cc View 2 3 4 3 chunks +47 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
sky
10 years, 8 months ago (2010-04-16 15:03:00 UTC) #1
Peter Kasting
This change is fine, but we should also include the scheme if the URL starts ...
10 years, 8 months ago (2010-04-16 16:43:09 UTC) #2
sky
Ok, I've incorporated the fix for 41652 as well. -Scott
10 years, 8 months ago (2010-04-16 17:49:08 UTC) #3
Peter Kasting
LGTM with one substantive change http://codereview.chromium.org/1574034/diff/10001/11002 File net/base/net_util.cc (right): http://codereview.chromium.org/1574034/diff/10001/11002#newcode771 net/base/net_util.cc:771: const char* const kFTP ...
10 years, 8 months ago (2010-04-16 18:06:59 UTC) #4
sky
10 years, 8 months ago (2010-04-16 18:28:36 UTC) #5
http://codereview.chromium.org/1574034/diff/10001/11002
File net/base/net_util.cc (right):

http://codereview.chromium.org/1574034/diff/10001/11002#newcode782
net/base/net_util.cc:782: // If the host starts with https[!a-z] we dont strip
either, otherwise the
On 2010/04/16 18:07:00, Peter Kasting wrote:
> I just realized that this misses one obvious case:
> 
> http://https//paypal.com
> 
> Here the hostname is just "https".  So I think we should also not strip the
> scheme if the hostname is "https" alone.

I thought of this, but then is someone really going to have an internal domain
as https? But I'll add coverage for it.

http://codereview.chromium.org/1574034/diff/10001/11002#newcode788
net/base/net_util.cc:788: host[kHTTPSSize] < 'a' || host[kHTTPSSize] > 'z') {
On 2010/04/16 18:07:00, Peter Kasting wrote:
> Nit: How about just
> 
> return (host.compare(0, kHTTPSSize, kHTTPS) != 0) || ((host.size() >
kHTTPSSize)
> && (host[kHTTPSSize] >= 'a') && (host[kHTTPSSize] <= 'z'));
> 
> (This includes returning "false" for a host of "https")

I realize I could do that, in fact I could have combined it all into a single if
but I find it more readable separated out this.

> BTW, is the host lowercased at this point so comparing against 'a' and 'z' is

Yes, Brett says it's always lowercase.

Powered by Google App Engine
This is Rietveld 408576698