Use proxy with WebViewGadget?
Use proxy with WebViewGadget?
Hi,
How to use a proxy with WebViewGadget?
Thanks in advance
How to use a proxy with WebViewGadget?
Thanks in advance
ARGENTINA WORLD CHAMPION
Re: Use proxy with WebViewGadget?
Think you might need to be a bit more specific.
a socks proxy?
a transparent http/https proxy?
a forward http proxy?
this might help
https://developer.mozilla.org/en-US/doc ... _tunneling
https://developer.mozilla.org/en-US/doc ... ds/CONNECT
you will probably need to use Infratec's curl module as HttpRequest functions don't have support for CONNECT
https://www.purebasic.fr/english/viewtopic.php?t=80118
a socks proxy?
a transparent http/https proxy?
a forward http proxy?
this might help
https://developer.mozilla.org/en-US/doc ... _tunneling
https://developer.mozilla.org/en-US/doc ... ds/CONNECT
you will probably need to use Infratec's curl module as HttpRequest functions don't have support for CONNECT
https://www.purebasic.fr/english/viewtopic.php?t=80118
Re: Use proxy with WebViewGadget?
HTTPS proxies for navigate, just to navigate using a different IP.
Sometime ago i used this:
Sometime ago i used this:
Code: Select all
Structure INTERNET_PROXY_INFO1
dwAccessType.l
lpszProxy.l
lpszProxyBypass.l
EndStructure
#INTERNET_OPTION_PROXY = 38
ProcedureDLL SetProxy1(Proxy.s, Port.l, flags.l=#INTERNET_OPEN_TYPE_PROXY) ; Set proxy for the current session
;/ Return 1 if success or 0 if fail
Protected ProxyServer.s = Proxy + ":" + Str(Port)
Protected PIInfo.INTERNET_PROXY_INFO1
PIInfo\dwAccessType = flags
PIInfo\lpszProxy = @ProxyServer
PIInfo\lpszProxyBypass = @""
If UrlMkSetSessionOption_(#INTERNET_OPTION_PROXY, @PIInfo, SizeOf(INTERNET_PROXY_INFO1), 0) = #S_OK
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
ARGENTINA WORLD CHAMPION
Re: Use proxy with WebViewGadget?
This might help assuming it's not node.js specific, see the 2nd code block down
maybe you can do that in the web gadget
https://arh.antoinevastel.com/nodejs/20 ... ncies.html
maybe you can do that in the web gadget
https://arh.antoinevastel.com/nodejs/20 ... ncies.html
Re: Use proxy with WebViewGadget?
In my WebView2Gadget() I do it like this:
Code: Select all
Procedure.i WebView2Gadget(Gadget.i, x.i, y.i, width.i, height.i, URL$, Window.i=#PB_Any, Proxy$="", ProxyBypass$="")
:
:
:
If Proxy$ = ""
Options$ + "--no-proxy-server "
Else
Options$ + "--proxy-server=" + #DQUOTE$ + Proxy$ + #DQUOTE$ + " "
EndIf
If ProxyBypass$ <> ""
Options$ + "--proxy-bypass-list=" + #DQUOTE$ + ProxyBypass$ + #DQUOTE$ + " "
EndIf
Re: Use proxy with WebViewGadget?
VebViewGadget is very nice, but is missing some basic funcionalities to be ready to use it in some real GUI.infratec wrote: Fri Aug 09, 2024 7:01 am In my WebView2Gadget() I do it like this:Code: Select all
Procedure.i WebView2Gadget(Gadget.i, x.i, y.i, width.i, height.i, URL$, Window.i=#PB_Any, Proxy$="", ProxyBypass$="") : : : If Proxy$ = "" Options$ + "--no-proxy-server " Else Options$ + "--proxy-server=" + #DQUOTE$ + Proxy$ + #DQUOTE$ + " " EndIf If ProxyBypass$ <> "" Options$ + "--proxy-bypass-list=" + #DQUOTE$ + ProxyBypass$ + #DQUOTE$ + " " EndIf
---------------------------
Last line(s) is missing, if is the last line, then its EndProcedure. But if there are 2 or more lines missing...
Where can i get your WebView2Gadget?
Thanks.
ARGENTINA WORLD CHAMPION
Re: Use proxy with WebViewGadget?
idle wrote: Fri Aug 09, 2024 2:30 am This might help assuming it's not node.js specific, see the 2nd code block down
maybe you can do that in the web gadget
https://arh.antoinevastel.com/nodejs/20 ... ncies.html
Hi, thanks.
But this is for use in some http request and not for WebViewGadget i think.
ARGENTINA WORLD CHAMPION
Re: Use proxy with WebViewGadget?
Thanks. I already download it.
But i dont find examples in the zip.
Where can i find examples?
What differences have with the PB WebViewGadget?
ARGENTINA WORLD CHAMPION
Re: Use proxy with WebViewGadget?
The example is at the end of the file WebView2Gadget,pbi
Simply load this file and run it.
To use a proxy, you have to set the parameters of WebView2Gadget() (also shown in the example but as comment)
Simply load this file and run it.
To use a proxy, you have to set the parameters of WebView2Gadget() (also shown in the example but as comment)
Re: Use proxy with WebViewGadget?
Could you elaborate?ricardo wrote: Fri Aug 09, 2024 7:14 amVebViewGadget is very nice, but is missing some basic funcionalities to be ready to use it in some real GUI.infratec wrote: Fri Aug 09, 2024 7:01 am In my WebView2Gadget() I do it like this:Code: Select all
Procedure.i WebView2Gadget(Gadget.i, x.i, y.i, width.i, height.i, URL$, Window.i=#PB_Any, Proxy$="", ProxyBypass$="") : : : If Proxy$ = "" Options$ + "--no-proxy-server " Else Options$ + "--proxy-server=" + #DQUOTE$ + Proxy$ + #DQUOTE$ + " " EndIf If ProxyBypass$ <> "" Options$ + "--proxy-bypass-list=" + #DQUOTE$ + ProxyBypass$ + #DQUOTE$ + " " EndIf
Re: Use proxy with WebViewGadget?
If you need username and password for the proxy, you have to use
Set a handler which returns the username and password to the webview.
https://learn.microsoft.com/en-us/micro ... abs=csharp
Handler in PB
Code: Select all
WebView2AddBasicAuthenticationHandler()https://learn.microsoft.com/en-us/micro ... abs=csharp
Handler in PB
Code: Select all
Procedure.i WebView2GadgetBasicAuthenticationRequested(*this.WV2_EVENT_HANDLER, sender.ICoreWebView2, args.ICoreWebView2BasicAuthenticationRequestedEventArgs)
Protected Result.i
Protected *Gadget.WebView2Gadget_Structure
Protected *basicAuthenticationResponse.ICoreWebView2BasicAuthenticationResponse
Debug "WebView2GadgetBasicAuthenticationRequested with gadget: " + Str(*this\context)
Result = #S_FALSE
*Gadget = FindMapElement(WebView2GadgetMap(), Str(*this\context))
If *Gadget
args\get_Response(@*basicAuthenticationResponse)
*basicAuthenticationResponse\put_UserName(#WebProxyUser)
*basicAuthenticationResponse\put_Password(#WebProxyPassword)
Result = #S_OK
EndIf
ProcedureReturn Result
EndProcedure
Re: Use proxy with WebViewGadget?
I added this in the example part of WebView2Gadget.pbi
Please download the zip file again.
Please download the zip file again.
Re: Use proxy with WebViewGadget?
If you wanted to do that cross platform wouldn't use http request with CONNECT or via curl since flag is missing in httprequest.
Im trying to understand what the question is as there are numerous kinds of proxy. So does this handle https transparent proxy?
Im trying to understand what the question is as there are numerous kinds of proxy. So does this handle https transparent proxy?
Re: Use proxy with WebViewGadget?
No, i want to do for Windows only.idle wrote: Sun Aug 11, 2024 1:23 am If you wanted to do that cross platform wouldn't use http request with CONNECT or via curl since flag is missing in httprequest.
Im trying to understand what the question is as there are numerous kinds of proxy. So does this handle https transparent proxy?
Yes, transparent proxies, just to be able to navigate with a different IP using some web browser (WebView).
ARGENTINA WORLD CHAMPION


