Proxy server switch in CEF3

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Proxy server switch in CEF3

Postby mistymorning » Sun May 04, 2014 8:30 am

I want to set the proxy server but it's not working

Code: Select all
Class WebApp : CefApp
.........
protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine)
        {
            commandLine.AppendArgument("--proxy-server=socks5://127.0.0.1:8888"); //Does not work
            if (Settings.NoProxyServer) commandLine.AppendSwitch("no-proxy-server")//Works OK to turn off
            if (Settings.NoReferrers) commandLine.AppendSwitch("no-referrers"); //This works fine
            base.OnBeforeCommandLineProcessing(processType, commandLine);
        }


I have tried --proxy-server=\"socks5://127.0.0.1:8888\" and commandLine.AppendSwitch but nothing seems to work even when i remove the current windows proxy server using control panel

Also I help needed to load extensions like Ghostery because I have had no joy with CefRuntime.RegisterExtension in function protected override void OnWebKitInitialized()
but I did learn that break-points don't fire in this function but you can add a messagebox.show("Yes worked"); to prove it has been called.
Building a web-browser that does not call home
mistymorning
Techie
 
Posts: 15
Joined: Sun May 04, 2014 8:08 am

Re: Proxy server switch in CEF3

Postby magreenblatt » Tue May 06, 2014 9:16 am

mistymorning wrote:I have tried --proxy-server=\"socks5://127.0.0.1:8888\" and commandLine.AppendSwitch but nothing seems to work even when i remove the current windows proxy server using control panel

You should use AppendSwitchWithValue("proxy-server", "socks5://127.0.0.1:8888")

mistymorning wrote:Also I help needed to load extensions like Ghostery because I have had no joy with CefRuntime.RegisterExtension in function protected override void OnWebKitInitialized()

If this is a Chrome extension it won't work in CEF as-is.

mistymorning wrote:but I did learn that break-points don't fire in this function but you can add a messagebox.show("Yes worked"); to prove it has been called.

The function executes in the renderer process. See https://code.google.com/p/chromiumembed ... #Processes.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Proxy server switch in CEF3

Postby mistymorning » Tue May 06, 2014 12:55 pm

magreenblatt

"You should use AppendSwitchWithValue("proxy-server", "socks5://127.0.0.1:8888")"

AppendSwitchWithValue is not in the object model anymore i don't think for CefCommandLine and
commandLine.AppendSwitch
commandLine.AppendArgument
both seem to work for other settings like

Code: Select all
if (Settings.NoReferrers) commandLine.AppendSwitch("no-referrers");
if (Settings.NoProxyServer) commandLine.AppendSwitch("no-proxy-server");


Just won't work for setting a proxy server for some reason or another but I did notice when I checked the commandLine in the release version then it comes pre populated with a lot more arguments than the running the debug version.

my CEF version data reads
public const int CEF_VERSION_MAJOR = 3;
public const int CEF_REVISION = 1567;
public const int COPYRIGHT_YEAR = 2014;
So hopefuly it's up to date.

"If this is a Chrome extension it won't work in CEF as-is."

Ghostery is a very common program and it works in SRWare-Iron or Opera but so far I cannot find what or how i should register extensions or if it needs a mainfest.js file

I am using CefGlue to render pages as a usercontrol inside a tab-control and would need to add buttons to the form for any extensions after first registering them
Building a web-browser that does not call home
mistymorning
Techie
 
Posts: 15
Joined: Sun May 04, 2014 8:08 am

Re: Proxy server switch in CEF3

Postby magreenblatt » Tue May 06, 2014 1:40 pm

mistymorning wrote:AppendSwitchWithValue is not in the object model anymore i don't think for CefCommandLine

Sounds like a bug / missing feature with CefGlue.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Proxy server switch in CEF3

Postby mistymorning » Wed May 07, 2014 12:11 pm

magreenblatt

I went back and found it

CefGlue has a overloaded AppendSwitch that takes two arguments that i didn't know about and that calls append_switch_with_value so the code

Code: Select all
commandLine.AppendSwitch("proxy-server", "http://127.0.0.1:9090");

Did the trick for me so thanks for your help
Building a web-browser that does not call home
mistymorning
Techie
 
Posts: 15
Joined: Sun May 04, 2014 8:08 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 23 guests