Page 1 of 2

ChromeRuntime and Proxy

Posted: Wed Apr 19, 2023 12:29 pm
by dilfich
Hi, it seems like a similar question was raised, but I didn't find something.
Namely, the problem with the proxy for which authorization is required, how to solve it?

Re: ChromeRuntime and Proxy

Posted: Thu Apr 20, 2023 6:18 am
by dilfich
I tried to add a header, but even in normal mode it doesn't work for some reason. Error ERR_INVALID_ARGUMENT

Code: Select all

...BeforeResourceLoad
....
TempNewMap.Append('Proxy-Authorization', 'Basic ZnJlZXVzZXIxOmZyZWV1c2VyMQ==');
TempNewMap.Append('Proxy-Connection', 'keep-alive');
This is how the connection of one of the VPN extensions looks like

Image

Re: ChromeRuntime and Proxy

Posted: Sat Apr 22, 2023 8:20 am
by salvadordf
The Chrome runtime mode is experimental and some features don't work yet.

Try using command line switches like --proxy-server with this value http://<user>:<pass>@<host>:<port>/, for example :

Code: Select all

GlobalCEFApp.AddCustomCommandLine('--proxy-server', 'http://username:password@myproxy.com:80');
That code line needs to be added before the GlobalCEFApp.StartMainProcess call.

Re: ChromeRuntime and Proxy

Posted: Sun Apr 23, 2023 6:20 am
by dilfich
This is certainly not a solution, but it doesn't work either.
ERR_NO_SUPPORTED_PROXIES
GlobalCEFApp.AddCustomCommandLine('--proxy-server', 'http://0401:oLEFKa@86.18.202.21:7952');

Is it possible to add headers via devtools? I tried, but I couldn't add them at all.

Code: Select all

tab.call_method("Network.setExtraHTTPHeaders", headers={"Authorization": "Basic " + context.base64_message})

Code: Select all

  TempList.SetString('{"Authorization": "Basic 12345"}');
  TempParams.SetValue('headers', TempList);
  Chrom.ExecuteDevToolsMethod(0, 'Network.setExtraHTTPHeaders', TempParams);

Re: ChromeRuntime and Proxy

Posted: Sun Apr 23, 2023 7:40 am
by dilfich
It turned out to add headers, but it still doesn't work

Code: Select all

 Chrom.ExecuteDevToolsMethod(0, 'Network.enable', nil);

  TempHeaders := TCefDictionaryValueRef.New;
  TempHeaders.SetString('Proxy-Authorization', 'Basic ZX45645gUZLYTduM0g=');
  TempHeaders.SetString('Proxy-Connection', 'keep-alive');

  TempParams.SetDictionary('headers', TempHeaders);
  Chrom.ExecuteDevToolsMethod(0, 'Network.setExtraHTTPHeaders', TempParams);
The problem is not only with the "Chrome runtime" in normal mode does not work either
ERR_INVALID_ARGUMENT

Re: ChromeRuntime and Proxy

Posted: Sun Apr 23, 2023 5:34 pm
by dilfich
And how to load the extension in ChromeRuntime? It seemed to work before. :?

Re: ChromeRuntime and Proxy

Posted: Mon Apr 24, 2023 9:02 am
by salvadordf
Try to use the command line switch with one of these Chromium builds :
https://chromium.woolyss.com/

If it works in Chromium, it should also work in CEF unless there's a new bug or a regression.

These kinds of problems happen with experimental code.

Re: ChromeRuntime and Proxy

Posted: Mon Apr 24, 2023 10:33 am
by dilfich
It doesn't work, it's probably been like this for a long time.

Thorium_AVX2_111.0.5563.111
But authorization works if you save the login \ password in the extension. Proxy Auto Auth

How do I add an extension here in Chrome Runtime mode? Previously, it was possible.

And error ERR_INVALID_ARGUMENT due to a security breach of changing headers sort of.

Re: ChromeRuntime and Proxy

Posted: Mon Apr 24, 2023 12:44 pm
by salvadordf
dilfich wrote: Mon Apr 24, 2023 10:33 am It doesn't work, it's probably been like this for a long time.
Thorium_AVX2_111.0.5563.111
But authorization works if you save the login \ password in the extension. Proxy Auto Auth
If an official Chromium build can't use that proxy and you need to install an extension then all you can do is try to reverse-engineer that extension to try to replicate what it does.
dilfich wrote: Mon Apr 24, 2023 10:33 am How do I add an extension here in Chrome Runtime mode? Previously, it was possible.
And error ERR_INVALID_ARGUMENT due to a security breach of changing headers sort of.
I have a limited experience with the Chrome runtime mode and I only installed an extension from the chrome extension store a few months ago.

Please, remember that CEF4Delphi is only a CEF wrapper, which includes Chromium. Some features are beyond the scope of the CEF4Delphi project.

Re: ChromeRuntime and Proxy

Posted: Mon Apr 24, 2023 2:59 pm
by dilfich
salvadordf wrote: Mon Apr 24, 2023 12:44 pm If an official Chromium build can't use that proxy and you need to install an extension then all you can do is try to reverse-engineer that extension to try to replicate what it does.
The problem is not in using a proxy, but in authorizing it.

As soon as the Chrome Runtime mode appeared, it was possible to install the extension, how to do it now?
91 (Mini Browser - CEF4Delphi) version of chrome on the screenshot.

Image

There is an extension in the archive, it is definitely working.