WebKitGtk proxy settings

Is underline library broken for proxy settings.
I am unable to use proxy with webkitgtk and webkit2gtk.

#include <iostream>
#include <string.h>
#include <gtk/gtk.h>
#ifdef USE_WEBKIT2
#include <webkit2/webkit2.h>
#else
#include <webkit/webkit.h>
#include <libsoup/soup.h>
#endif
int main(int argc,char*argv[])
{
 std::string proxy_url = "socks5://username:password@127.0.0.1:9009";
 gtk_init(&argc,&argv);
 GtkWidget*window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#ifdef USE_WEBKIT2
 WebKitWebContext * context = 	webkit_web_context_new ();
 WebKitNetworkProxySettings * proxy_settings =
  webkit_network_proxy_settings_new (proxy_url.c_str(),nullptr);
 webkit_web_context_set_network_proxy_settings
 (context,
  WEBKIT_NETWORK_PROXY_MODE_CUSTOM,
  proxy_settings);
 GtkWidget* view = webkit_web_view_new_with_context(context);
 WebKitSettings*settings = webkit_web_view_get_settings(WEBKIT_WEB_VIEW(view));
 webkit_settings_set_enable_javascript(settings,true);
 webkit_web_view_set_settings(WEBKIT_WEB_VIEW(view),settings);
#else
 GtkWidget* view = webkit_web_view_new();
 WebKitWebSettings * settings =	webkit_web_settings_new ();
 g_object_set (G_OBJECT(settings), "enable-scripts", TRUE, NULL);
 webkit_web_view_set_settings (WEBKIT_WEB_VIEW(view), settings);
 soup_session_add_feature_by_type(webkit_get_default_session(),
                                  SOUP_TYPE_PROXY_RESOLVER_DEFAULT);
 SoupURI *proxyUri = soup_uri_new(proxy_url.c_str());
 g_object_set(webkit_get_default_session(),
              SOUP_SESSION_PROXY_URI, proxyUri, NULL);
 soup_uri_free(proxyUri);
#endif
 gtk_container_add(GTK_CONTAINER(window),view);
 webkit_web_view_load_uri(WEBKIT_WEB_VIEW(view),"https://www.google.com/");
 gtk_widget_show_all(window);
 gtk_main();
 return 0;
}

On CentOS it successfully login to my proxy, but then leave communication for no reason.
On Raspberry pi - Raspberian OS it sends only username, password is not used… :smiley:
On both OS it ends up with error about usrename or password is incorrect for proxy connection.
Without credentials is outputs that GIO library does not support auth method requested by the proxy.
If I disable auth on my proxy, then it just shows blank page.
I tested my proxy with firefox and chrome browsers, also I have tested with python Qt5Webkit, works normally, only gtkwebkit is unable to use the proxy.
Why?
Also, webkitgtk crashes on windows OS if you click on link with invalid href like “javascript:void(0);”

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.