Commit 6861b5f8 authored by Lucian Langa's avatar Lucian Langa
Browse files

add GNOME_PROXY_RESOLVER for webkit session

parent 542dc322
2009-05-12 Lucian Langa <lucilanga@gnome.org>
* src/network-soup.c: add GNOME_PROXY_RESOLVER for webkit session
* src/rss.c (webkit_set_preferences), (gecko_set_preferences),
(finish_website): fix compiler defines
2009-05-09 Lucian Langa <lucilanga@gnome.org>
* src/network-soup.c: correctly use gnome settings entry
......
......@@ -40,6 +40,7 @@
#define d(x)
SoupCookieJar *rss_soup_jar = NULL;
gint proxy_type = 0;
extern rssfeed *rf;
extern GConfClient *rss_gconf;
......@@ -194,23 +195,30 @@ void
proxify_webkit_session(EProxy *proxy, gchar *uri)
{
SoupURI *proxy_uri = NULL;
gint ptype = gconf_client_get_int (rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
if (e_proxy_require_proxy_for_uri (proxy, uri)) {
proxy_uri = e_proxy_peek_uri_for (proxy, uri);
g_print("webkit proxified %s with %s:%d\n", uri, proxy_uri->host, proxy_uri->port);
} else
g_print("webkit no PROXY-%s\n", uri);
switch (ptype) {
case 2:
if (e_proxy_require_proxy_for_uri (proxy, uri)) {
proxy_uri = e_proxy_peek_uri_for (proxy, uri);
g_print("webkit proxified %s with %s:%d\n", uri, proxy_uri->host, proxy_uri->port);
} else
g_print("webkit no PROXY-%s\n", uri);
break;
g_object_set (G_OBJECT (webkit_session), SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
case 0:
soup_session_add_feature_by_type (webkit_session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
break;
}
g_object_set (G_OBJECT (webkit_session), SOUP_SESSION_PROXY_URI, proxy_uri, NULL);
}
//this will insert proxy in the session
void
proxify_session(EProxy *proxy, SoupSession *session, gchar *uri)
{
gint ptype = gconf_client_get_int (rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
SoupURI *proxy_uri = NULL;
gint ptype = gconf_client_get_int (rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
switch (ptype) {
case 2:
......@@ -498,6 +506,7 @@ net_get_unblocking(gchar *url,
// soup_session_async_new_with_options(SOUP_SESSION_TIMEOUT, SS_TIMEOUT, NULL);
soup_session_async_new();
soup_session_add_feature(soup_sess, SOUP_SESSION_FEATURE(rss_soup_jar));
proxify_session(proxy, soup_sess, url);
if (cb && data) {
info = g_new0(CallbackInfo, 1);
......@@ -587,6 +596,7 @@ net_post_blocking(gchar *url, GSList *headers, GString *post,
else
soup_sess = rf->b_session;
g_signal_connect (soup_sess, "authenticate",
G_CALLBACK (authenticate), soup_sess);
#if LIBSOUP_VERSION < 2003000
......@@ -731,9 +741,5 @@ abort_all_soup(void)
void
rss_soup_init(void)
{
proxy_type = gconf_client_get_int (rss_gconf, KEY_GCONF_EVO_PROXY_TYPE, NULL);
if (proxy_type < PROXY_TYPE_SYSTEM || proxy_type > PROXY_TYPE_AUTO_URL)
proxy_type = PROXY_TYPE_SYSTEM;
// SoupCookieJar *soup_jar;
// soup_jar = soup_cookie_jar_sqlite_new ("/home/cooly/.newcookies.sqlite", TRUE);
//rss_soup_jar = soup_cookie_jar_sqlite_new ("/home/cooly/.newcookies.sqlite", FALSE);
}
......@@ -182,6 +182,7 @@ gsize pixfilelen;
extern int xmlSubstituteEntitiesDefaultValue;
extern EProxy *proxy;
SoupSession *webkit_session = NULL;
SoupCookieJar *rss_soup_jar;
rssfeed *rf = NULL;
guint upgrade = 0; // set to 2 when initailization successfull
......@@ -1450,6 +1451,7 @@ webkit_set_preferences(void)
{
#ifdef HAVE_WEBKIT
webkit_session = webkit_get_default_session();
soup_session_add_feature(webkit_session, SOUP_SESSION_FEATURE(rss_soup_jar));
#endif
}
......@@ -1467,6 +1469,8 @@ gecko_set_preferences(void)
gchar *agstr = g_strdup_printf("Evolution/%s; Evolution-RSS/%s",
EVOLUTION_VERSION_STRING, VERSION);
gecko_prefs_set_string("general.useragent.extra.firefox", agstr);
gecko_prefs_set_int("browser.ssl_override_behaviour", 2);
gecko_prefs_set_bool("browser.xul.error_pages.enabled", FALSE);
g_free(agstr);
//I'm only forcing scheme here
uri = e_proxy_peek_uri_for(proxy, "http:///");
......@@ -1556,6 +1560,7 @@ webkit_click (GtkEntry *entry,
return TRUE;
}
#ifdef HAVE_GECKO
gboolean
gecko_click(GtkMozEmbed *mozembed, gpointer dom_event, gpointer user_data)
{
......@@ -1599,6 +1604,7 @@ gecko_click(GtkMozEmbed *mozembed, gpointer dom_event, gpointer user_data)
g_print("button:%d\n", button);
return TRUE;
}
#endif
#ifdef HAVE_RENDERKIT
static gboolean
......@@ -2791,6 +2797,7 @@ finish_website (SoupMessage *msg, gpointer user_data)
finish_website (SoupSession *soup_sess, SoupMessage *msg, gpointer user_data)
#endif
{
g_return_if_fail(rf->mozembed);
GString *response = g_string_new_len(msg->response_body->data, msg->response_body->length);
guint engine = fallback_engine();
g_print("browser full:%d\n", (int)response->len);
......@@ -2804,8 +2811,10 @@ finish_website (SoupSession *soup_sess, SoupMessage *msg, gpointer user_data)
g_print("len:%d\n", len);
if (len>0) {
browser_write(str, len, user_data);
#ifdef HAVE_GECKO
if (engine == 2)
gtk_moz_embed_close_stream(GTK_MOZ_EMBED(rf->mozembed));
#endif
g_string_free(response, 1);
// gtk_widget_show(rf->mozembed);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment