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

Issue 49009: Proxy config for Linux (ProxyConfigServiceLinux)... (Closed)

Created:
11 years, 9 months ago by Maxim Ermilov
Modified:
9 years, 7 months ago
Reviewers:
eroman, wtc, sdoyon
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

[This changelist has been replaced by http://codereview.chromium.org/60009 .] Use GNOME proxy settings. If that failed, use http_proxy/ftp_proxy/no_proxy from the environment. R=eroman,wtc BUG=8143

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 2

Patch Set 5 : '' #

Total comments: 29

Patch Set 6 : '' #

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 20
Unified diffs Side-by-side diffs Delta from patch set Stats (+342 lines, -9 lines) Patch
M build/SConscript.main View 1 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M chrome/app/chrome_exe_main_gtk.cc View 1 3 4 5 6 7 2 chunks +7 lines, -0 lines 0 comments Download
M net/net_lib.scons View 1 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
A net/proxy/proxy_config_service_linux.h View 1 4 5 6 7 1 chunk +22 lines, -0 lines 1 comment Download
A net/proxy/proxy_config_service_linux.cc View 1 4 5 6 7 1 chunk +306 lines, -0 lines 19 comments Download
M net/proxy/proxy_service.cc View 1 3 4 5 6 7 3 chunks +5 lines, -9 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
wtc
Thanks a lot for the patch. I didn't have time to review proxy_config_service_linux.cc in detail ...
11 years, 9 months ago (2009-03-23 23:55:25 UTC) #1
Maxim Ermilov
> Line 5: #include <glib.h> > Your changes to chrome_exe_main_gtk.cc seem unrelated to > the ...
11 years, 9 months ago (2009-03-24 00:57:33 UTC) #2
wtc
Eric, you should look at this changelist, too.
11 years, 9 months ago (2009-03-24 17:42:29 UTC) #3
eroman
thanks for the patch. I have reviewed the non-gtk specific stuff (not familiar with GTK). ...
11 years, 9 months ago (2009-03-24 18:42:41 UTC) #4
Maxim Ermilov
On 2009/03/24 18:42:41, eroman wrote: > http://codereview.chromium.org/49009/diff/2017/3015#newcode8 > Line 8: #include <string.h> > is both ...
11 years, 9 months ago (2009-03-24 23:18:20 UTC) #5
sdoyon
OK, I'd been working on this last week. Sorry I was unavailable for the last ...
11 years, 9 months ago (2009-03-25 18:50:52 UTC) #6
Maxim Ermilov
On 2009/03/25 18:50:52, sdoyon wrote: > OK, I'd been working on this last week. Sorry ...
11 years, 9 months ago (2009-03-25 21:34:37 UTC) #7
Maxim Ermilov
Add support for "https_proxy" and "all_proxy","auto_proxy","SOCKS_SERVER" and "SOCKS_VERSION". Correct code, that work with "no_proxy". Use ...
11 years, 9 months ago (2009-03-27 01:24:03 UTC) #8
sdoyon
Thank you for your changes. Some more comments: IsValidDomain() will reject IPv6 addresses. I guess ...
11 years, 9 months ago (2009-03-27 20:41:31 UTC) #9
Maxim Ermilov
I correct my patch. On 2009/03/27 20:41:31, sdoyon wrote: > Perhaps we could get this ...
11 years, 9 months ago (2009-03-28 00:38:28 UTC) #10
eroman
11 years, 8 months ago (2009-03-30 21:25:08 UTC) #11
Thanks for making those changes.

I have a couple more style nits comments.

Also, it would be great to have some unit-test coverage. I recognize it is a bit
of a pain to isolate the dependencies. As part of "taking my own medicine" I
just added such a unit-test for the windows version [see
http://codereview.chromium.org/55001].

Lastly:

Just a heads up, but I am making some changes to |proxy_rules|, in order to
avoid needing to create a string here (http://codereview.chromium.org/57011). If
I end up getting this into repository soonish, it will require some extra
modifications in this CL to match.

http://codereview.chromium.org/49009/diff/5002/5007
File net/proxy/proxy_config_service_linux.cc (right):

http://codereview.chromium.org/49009/diff/5002/5007#newcode50
Line 50: bool IsValidDomain(const std::string& str) {
nit: make this "static".

http://codereview.chromium.org/49009/diff/5002/5007#newcode54
Line 54: if ( !(isalnum(str[i]) || str[i] == '.' || str[i] == '-' ||
nit: remove the space here "( !"

http://codereview.chromium.org/49009/diff/5002/5007#newcode61
Line 61: ProxyServer GetProxyServerFromGconf(
nit: make this "static".

http://codereview.chromium.org/49009/diff/5002/5007#newcode69
Line 69: ProxyServer result; // Initialized to invalid.
nit: two spaces between ";" and "/"

http://codereview.chromium.org/49009/diff/5002/5007#newcode73
Line 73: proxy_port = ProxyServer::GetDefaultPortForScheme (scheme);
nit: no space between "GetDefaultPortForScheme" and "("

http://codereview.chromium.org/49009/diff/5002/5007#newcode81
Line 81: bool GetProxyConfigGCONF(ProxyConfig* config) {
nit: make this "static".

http://codereview.chromium.org/49009/diff/5002/5007#newcode82
Line 82: bool res = true;
nit: I would suggest a more descriptive name like "result" or "ok".

http://codereview.chromium.org/49009/diff/5002/5007#newcode110
Line 110: client,
nit: indent these parameters by 4 spaces instead of 2.

http://codereview.chromium.org/49009/diff/5002/5007#newcode125
Line 125: client,
nit: indent these parameters by 4 spaces instead of 2.

http://codereview.chromium.org/49009/diff/5002/5007#newcode138
Line 138: client,
nit: indent these parameters by 4 spaces instead of 2.

http://codereview.chromium.org/49009/diff/5002/5007#newcode169
Line 169: GCONF_VALUE_STRING, NULL);
nit: two more spaces to line this up.

http://codereview.chromium.org/49009/diff/5002/5007#newcode193
Line 193: } kSchemeInEnv[] = {
nit: can you make this "static" ?

http://codereview.chromium.org/49009/diff/5002/5007#newcode208
Line 208: if (auto_proxy != NULL) {
nit: for consistency, consider "if (auto_proxy)"

http://codereview.chromium.org/49009/diff/5002/5007#newcode215
Line 215: if (socks_ver != NULL && socks_server != NULL) {
nit: for consistency consider omitting "!= NULL"

http://codereview.chromium.org/49009/diff/5002/5007#newcode237
Line 237: if (all_proxy != NULL) {
nit: for consistency consider omitting "!= NULL".

http://codereview.chromium.org/49009/diff/5002/5007#newcode246
Line 246: if (proxy != NULL) {
nit: for consistency consider omitting "!= NULL".

http://codereview.chromium.org/49009/diff/5002/5007#newcode249
Line 249: if (config->proxy_rules.size() > 1)
I believe you can just test > 0 here (i.e. not empty).

http://codereview.chromium.org/49009/diff/5002/5007#newcode266
Line 266: str += no_proxy[i];
instead of stripping whitespace here, I would suggest stripping the whitespace
around each token within the loop:

std::string bypass_url_domain;
TrimWhitespaceASCII(proxy_server_bypass_list.token(), TRIM_ALL, &url_domain);

TrimWhitespaceASCII() is defined in base/string_util.h. I encourage checking it
out to see if it can meet your needs (strips more than just SP).

http://codereview.chromium.org/49009/diff/5002/5007#newcode272
Line 272: if (sscanf(bypass_url_domain.c_str(), "%d.%d.%d.%d",
I recommend using GURL to test if it is an IP address or not (that way it should
work with IPv6 too).

I believe the following snippet should work (typing it out using
GURL::HostIsIPAddress() as a guide):



#include "googleurl/src/url_canon.h"

...

bool IsIpAddress(const std::string& domain) {
  url_canon::RawCanonOutputT<char, 128> ignored_output;
  url_parse::Component ignored_component;
  url_parse::Component domain_comp(0, domain.size());
  return url_canon::CanonicalizeIPAddress(domain.c_str(), domain_comp,
                                          &ignored_output, &ignored_component);
}

http://codereview.chromium.org/49009/diff/5002/5008
File net/proxy/proxy_config_service_linux.h (right):

http://codereview.chromium.org/49009/diff/5002/5008#newcode14
Line 14: ProxyConfigServiceLinux() {
minor nit: can leave this off since it's empty.

Powered by Google App Engine
This is Rietveld 408576698