New issue
Advanced search Search tips
Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment
link

Issue 72692: Handle UTF-8 URLs in Proxy Settings API

Reported by battre@chromium.org, Feb 11 2011 Project Member

Issue description

Currently net::* expects URLs to be ASCII encoded but URLs are passed from V8 as UTF-8. This needs to be addressed.

Currently, the entire Proxy Settings API supports only ASCII URLs.
 

Comment 1 by battre@chromium.org, Feb 11 2011

Comment by eroman in http://codereview.chromium.org/6469030/diff/2001/chrome/browser/extensions/extension_proxy_api.cc:
There are string encoding problems in this file.

Note that strings originating from the javascript are wide. When calling
DictionaryValue:GetString() with a std::string, really we are getting UTF-8
encoded strings.

However a lot of this file is doing tokenizing assuming an ASCII input. And
certainly the net::* proxy parsing functions which are ultimately passed these
inputs, is similarly expecting ASCII input.

I generally recommend avoiding this pitfall by only ever extracting strings from
Value's using string16 -- this forces the code to have to deal with unicode of
the string, and avoids passing it around to functions that take ASCII inputs
(since you get compiletime failures!)

For now you might want to call DictionaryValue::GetStringAsASCII(), so the other
code doesn't need to be prepared to handle UTF8, and then just file some
TODOs/bugs on handling wide inputs.

You might be wandering whether it makes sense for javascript to be passing wide
strings -- yes it does. As far as the network stack is concerned, hostnames are
always ASCII. However as far as the user is concerned, international hostnames
can be represented using unicode (there is a translation layer to ASCII called
punycode).

This same issues has come up for PAC scripts, which similarly are javascript
code doing proxy stuff. We currently handle wide hostnames issued by PAC scripts
correctly (in the dnsResolve()/dnsResolveEx() bindings. However there is an
outstanding bug to create UTF16 aware parsing routines for proxy lists. See
http://crbug.com/47234.

Comment 2 by rahulrc@chromium.org, May 13 2011

Labels: -mstone-x

Comment 3 by laforge@google.com, Mar 7 2012

Status: Assigned
Available + Owner == Default to Assigned

Comment 4 by bugdroid1@chromium.org, Mar 10 2013

Project Member
Labels: -Area-Internals -Feature-Extensions Cr-Internals Cr-Platform-Extensions

Sign in to add a comment