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

Issue 210028: Respect the charset specified in PAC file responses. ProxyScriptFetcher is no... (Closed)

Created:
11 years, 3 months ago by eroman
Modified:
9 years, 6 months ago
Reviewers:
jungshik at Google, wtc
CC:
chromium-reviews_googlegroups.com, darin (slow to review), Paweł Hajdan Jr.
Visibility:
Public.

Description

Respect the charset specified in PAC file responses. I have updated the documentation of ProxyResolver and ProxyScriptFetcher to indicate that the response must always be given as UTF8. So ProxyScriptFetcher is responsible for any charset conversions internally. This CL also adds a unit-test to make sure that content-encodings are respected (like gzip). This was not previously broken, but it is a related area (and wasn't being tested.) BUG=http://crbug.com/22310 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=26790

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 12

Patch Set 4 : Address wtc's comments #

Patch Set 5 : re-order parameter so output is last #

Unified diffs Side-by-side diffs Delta from patch set Stats (+89 lines, -19 lines) Patch
A net/data/proxy_script_fetcher_unittest/gzipped_pac View Binary file 0 comments Download
A net/data/proxy_script_fetcher_unittest/gzipped_pac.mock-http-headers View 1 1 chunk +3 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/utf16be_pac View Binary file 0 comments Download
A net/data/proxy_script_fetcher_unittest/utf16be_pac.mock-http-headers View 1 1 chunk +2 lines, -0 lines 0 comments Download
M net/proxy/proxy_resolver.h View 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M net/proxy/proxy_resolver_v8.h View 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/proxy/proxy_resolver_v8.cc View 1 2 3 4 4 chunks +7 lines, -7 lines 0 comments Download
M net/proxy/proxy_script_fetcher.h View 1 2 3 4 2 chunks +4 lines, -4 lines 0 comments Download
M net/proxy/proxy_script_fetcher.cc View 1 2 3 4 2 chunks +32 lines, -2 lines 0 comments Download
M net/proxy/proxy_script_fetcher_unittest.cc View 1 2 3 4 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
eroman
wtc: please review this change in its entirety. jshin: comment for you below :) http://codereview.chromium.org/210028/diff/1003/1006 ...
11 years, 3 months ago (2009-09-19 02:39:58 UTC) #1
wtc
LGTM. http://codereview.chromium.org/210028/diff/1003/1005 File net/proxy/proxy_resolver_v8.cc (right): http://codereview.chromium.org/210028/diff/1003/1005#newcode32 Line 32: // Convert a std::string (UTF8) to a ...
11 years, 3 months ago (2009-09-21 18:28:16 UTC) #2
eroman
http://codereview.chromium.org/210028/diff/1003/1005 File net/proxy/proxy_resolver_v8.cc (right): http://codereview.chromium.org/210028/diff/1003/1005#newcode32 Line 32: // Convert a std::string (UTF8) to a V8 ...
11 years, 3 months ago (2009-09-21 20:06:30 UTC) #3
wtc
http://codereview.chromium.org/210028/diff/1003/1005 File net/proxy/proxy_resolver_v8.cc (right): http://codereview.chromium.org/210028/diff/1003/1005#newcode32 Line 32: // Convert a std::string (UTF8) to a V8 ...
11 years, 3 months ago (2009-09-22 01:15:58 UTC) #4
eroman
http://codereview.chromium.org/210028/diff/1003/1005 File net/proxy/proxy_resolver_v8.cc (right): http://codereview.chromium.org/210028/diff/1003/1005#newcode32 Line 32: // Convert a std::string (UTF8) to a V8 ...
11 years, 3 months ago (2009-09-22 01:35:24 UTC) #5
darin (slow to review)
11 years, 3 months ago (2009-09-22 03:59:54 UTC) #6
On Mon, Sep 21, 2009 at 6:35 PM, <eroman@chromium.org> wrote:

>
> http://codereview.chromium.org/210028/diff/1003/1005
> File net/proxy/proxy_resolver_v8.cc (right):
>
> http://codereview.chromium.org/210028/diff/1003/1005#newcode32
> Line 32: // Convert a std::string (UTF8) to a V8 string.
> On 2009/09/22 01:15:58, wtc wrote:
>
>> On 2009/09/21 20:06:30, eroman wrote:
>> >
>> > It will work in the sense that V8 will see a bunch of bytes and
>>
> assume they
>
>> are
>> > UTF8 encoded.
>>
>
>  Are you saying that V8 strings are all UTF-8?
>>
>
> From the documentation of String::New() in v8.h:
>
>  /**
>   * Allocates a new string from either utf-8 encoded or ascii data.
>   * The second parameter 'length' gives the buffer length.
>   * If the data is utf-8 encoded, the caller must
>   * be careful to supply the length parameter.
>   * If it is not given, the function calls
>   * 'strlen' to determine the buffer length, it might be
>   * wrong if 'data' contains a null character.
>   */
>  static Local<String> New(const char* data, int length = -1);
>
>
> So the expectation is that the byte data you give it, is UTF8. (or
> ASCII, but that is just a subset of UTF8).
>
> Internally I am not sure how V8 stores the strings (probably as UTF8),
> but that doesn't really matter; the only bit I really care about is what
> data format String::New(const char* data, int len) is expecting.
>
>
You should be good passing UTF-8 data to this function.  (V8 does prefer
UTF-8 internally.)

-Darin



>
> http://codereview.chromium.org/210028
>

Powered by Google App Engine
This is Rietveld 408576698