diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index 284d85f..241cc73 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -64,6 +64,7 @@ soup_headers =			\
 	soup-date.h		\
 	soup-form.h		\
 	soup-headers.h		\
+	soup-libproxy-features.h \
 	soup-logger.h		\
 	soup-message.h		\
 	soup-message-body.h	\
@@ -103,6 +104,7 @@ libsoup_2_4_la_LIBADD =			\
 	$(LIBGNUTLS_LIBS_STATIC)	\
 	$(LIBGNUTLS_LIBS)		\
 	$(LIBGCRYPT_LIBS)		\
+	$(LIBPROXY_LIBS)		\
 	$(LIBWS2_32)
 
 libsoup_2_4_la_SOURCES =		\
@@ -137,6 +139,7 @@ libsoup_2_4_la_SOURCES =		\
 	soup-form.c			\
 	soup-gnutls.c			\
 	soup-headers.c			\
+	soup-libproxy-features.h	\
 	soup-logger.c			\
 	soup-message.c			\
 	soup-message-body.c		\
@@ -155,6 +158,8 @@ libsoup_2_4_la_SOURCES =		\
 	soup-path-map.h     		\
 	soup-path-map.c     		\
 	soup-proxy-resolver.c		\
+	soup-proxy-resolver-libproxy.h	\
+	soup-proxy-resolver-libproxy.c	\
 	soup-proxy-resolver-static.h	\
 	soup-proxy-resolver-static.c	\
 	soup-proxy-uri-resolver.c	\
@@ -188,7 +193,6 @@ libsoup_gnome_2_4_la_LIBADD =		\
 	libsoup-2.4.la			\
 	$(GLIB_LIBS)			\
 	$(GCONF_LIBS)			\
-	$(LIBPROXY_LIBS)		\
 	$(SQLITE_LIBS)			\
 	$(GNOME_KEYRING_LIBS)
 
diff --git a/libsoup/soup-libproxy-features.h b/libsoup/soup-libproxy-features.h
index e69de29..28420c8 100644
--- a/libsoup/soup-libproxy-features.h
+++ b/libsoup/soup-libproxy-features.h
@@ -0,0 +1,15 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#ifndef SOUP_LIBPROXY_FEATURES_H
+#define SOUP_LIBPROXY_FEATURES_H 1
+
+#include <libsoup/soup-types.h>
+
+G_BEGIN_DECLS
+
+GType soup_proxy_resolver_libproxy_get_type (void);
+#define SOUP_TYPE_PROXY_RESOLVER_LIBPROXY (soup_proxy_resolver_libproxy_get_type ())
+
+G_END_DECLS
+
+#endif /* SOUP_LIBPROXY_FEATURES_H */
diff --git a/libsoup/soup-proxy-resolver-libproxy.c b/libsoup/soup-proxy-resolver-libproxy.c
index e69de29..0e38c79 100644
--- a/libsoup/soup-proxy-resolver-libproxy.c
+++ b/libsoup/soup-proxy-resolver-libproxy.c
@@ -0,0 +1,184 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * soup-proxy-resolver-libproxy.c: libproxy proxy resolution
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "soup-proxy-resolver-libproxy.h"
+#include "soup-proxy-uri-resolver.h"
+#include "soup-message.h"
+#include "soup-misc.h"
+#include "soup-session-feature.h"
+#include "soup-uri.h"
+
+#include <proxy.h>
+
+typedef struct {
+	pxProxyFactory *libproxy_factory;
+
+} SoupProxyResolverLibProxyPrivate;
+
+#define SOUP_PROXY_RESOLVER_LIBPROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY, SoupProxyResolverLibProxyPrivate))
+
+static void soup_proxy_resolver_libproxy_interface_init (SoupProxyURIResolverInterface *proxy_resolver_interface);
+
+G_DEFINE_TYPE_EXTENDED (SoupProxyResolverLibProxy, soup_proxy_resolver_libproxy, G_TYPE_OBJECT, 0,
+			G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE, NULL)
+			G_IMPLEMENT_INTERFACE (SOUP_TYPE_PROXY_URI_RESOLVER, soup_proxy_resolver_libproxy_interface_init))
+
+static void get_proxy_uri_async (SoupProxyURIResolver  *proxy_uri_resolver,
+				 SoupURI               *uri,
+				 GMainContext          *async_context,
+				 GCancellable          *cancellable,
+				 SoupProxyURIResolverCallback callback,
+				 gpointer               user_data);
+static guint get_proxy_uri_sync (SoupProxyURIResolver  *proxy_uri_resolver,
+				 SoupURI               *uri,
+				 GCancellable          *cancellable,
+				 SoupURI              **proxy_uri);
+
+static void
+soup_proxy_resolver_libproxy_init (SoupProxyResolverLibProxy *resolver_libproxy)
+{
+	SoupProxyResolverLibProxyPrivate *priv;
+	priv = SOUP_PROXY_RESOLVER_LIBPROXY_GET_PRIVATE (resolver_libproxy);
+	priv->libproxy_factory = px_proxy_factory_new ();
+}
+
+static void
+finalize (GObject *object)
+{
+	SoupProxyResolverLibProxyPrivate *priv =
+		SOUP_PROXY_RESOLVER_LIBPROXY_GET_PRIVATE (object);
+
+	if (priv->libproxy_factory)
+		px_proxy_factory_free (priv->libproxy_factory);
+
+	G_OBJECT_CLASS (soup_proxy_resolver_libproxy_parent_class)->finalize (object);
+}
+
+static void
+soup_proxy_resolver_libproxy_class_init (SoupProxyResolverLibProxyClass *libproxy_class)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (libproxy_class);
+
+	g_type_class_add_private (libproxy_class, sizeof (SoupProxyResolverLibProxyPrivate));
+	object_class->finalize = finalize;
+}
+
+static void
+soup_proxy_resolver_libproxy_interface_init (SoupProxyURIResolverInterface *proxy_uri_resolver_interface)
+{
+	proxy_uri_resolver_interface->get_proxy_uri_async = get_proxy_uri_async;
+	proxy_uri_resolver_interface->get_proxy_uri_sync = get_proxy_uri_sync;
+}
+
+static guint
+get_proxy_for_uri (SoupURI *uri, SoupURI **proxy_uri,
+                   pxProxyFactory *libproxy_factory)
+{
+	char *uristr, **proxies;
+	gboolean got_proxy;
+	int i;
+
+	*proxy_uri = NULL;
+
+	uristr = soup_uri_to_string (uri, FALSE);
+	proxies = px_proxy_factory_get_proxies (libproxy_factory, uristr);
+	g_free (uristr);
+
+	if (!proxies)
+		return SOUP_STATUS_OK;
+
+	got_proxy = FALSE;
+	for (i = 0; proxies[i]; i++) {
+		if (!strcmp (proxies[i], "direct://")) {
+			got_proxy = TRUE;
+			break;
+		}
+		if (strncmp (proxies[i], "http://", 7) == 0) {
+			*proxy_uri = soup_uri_new (proxies[i]);
+			got_proxy = TRUE;
+			break;
+		}
+	}
+	for (i = 0; proxies[i]; i++)
+		free (proxies[i]);
+	free (proxies);
+
+	if (got_proxy)
+		return SOUP_STATUS_OK;
+	else
+		return SOUP_STATUS_CANT_RESOLVE_PROXY;
+}
+
+typedef struct {
+	SoupProxyURIResolver *proxy_uri_resolver;
+	SoupURI *uri, *proxy_uri;
+	GMainContext *async_context;
+	GCancellable *cancellable;
+	guint status;
+	SoupProxyURIResolverCallback callback;
+	gpointer user_data;
+} SoupLibProxyAsyncData;
+
+static gboolean
+resolved_proxy (gpointer data)
+{
+	SoupLibProxyAsyncData *spad = data;
+
+	spad->callback (spad->proxy_uri_resolver, spad->status,
+			spad->proxy_uri, spad->user_data);
+	g_object_unref (spad->proxy_uri_resolver);
+	if (spad->uri)
+		soup_uri_free (spad->uri);
+	if (spad->async_context)
+		g_main_context_unref (spad->async_context);
+	if (spad->cancellable)
+		g_object_unref (spad->cancellable);
+	if (spad->proxy_uri)
+		soup_uri_free (spad->proxy_uri);
+	g_slice_free (SoupLibProxyAsyncData, spad);
+
+	return FALSE;
+}
+
+static void
+get_proxy_uri_async (SoupProxyURIResolver  *proxy_uri_resolver,
+		     SoupURI               *uri,
+		     GMainContext          *async_context,
+		     GCancellable          *cancellable,
+		     SoupProxyURIResolverCallback callback,
+		     gpointer               user_data)
+{
+	SoupLibProxyAsyncData *spad;
+	SoupProxyResolverLibProxyPrivate *priv =
+		SOUP_PROXY_RESOLVER_LIBPROXY_GET_PRIVATE (proxy_uri_resolver);
+
+	spad = g_slice_new0 (SoupLibProxyAsyncData);
+	spad->proxy_uri_resolver = g_object_ref (proxy_uri_resolver);
+	spad->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
+	spad->callback = callback;
+	spad->user_data = user_data;
+	spad->status = get_proxy_for_uri (uri, &spad->proxy_uri,
+	                                  priv->libproxy_factory);
+	soup_add_completion (async_context, resolved_proxy, spad);
+}
+
+static guint
+get_proxy_uri_sync (SoupProxyURIResolver  *proxy_uri_resolver,
+		    SoupURI               *uri,
+		    GCancellable          *cancellable,
+		    SoupURI              **proxy_uri)
+{
+	SoupProxyResolverLibProxyPrivate *priv =
+		SOUP_PROXY_RESOLVER_LIBPROXY_GET_PRIVATE (proxy_uri_resolver);
+	return get_proxy_for_uri (uri, proxy_uri, priv->libproxy_factory);
+}
diff --git a/libsoup/soup-proxy-resolver-libproxy.h b/libsoup/soup-proxy-resolver-libproxy.h
index e69de29..29a62e2 100644
--- a/libsoup/soup-proxy-resolver-libproxy.h
+++ b/libsoup/soup-proxy-resolver-libproxy.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <libsoup/soup-libproxy-features.h>
+#include <libsoup/soup-types.h>
+
+#ifndef SOUP_PROXY_RESOLVER_LIBPROXY_H
+#define SOUP_PROXY_RESOLVER_LIBPROXY_H 1
+
+#define SOUP_PROXY_RESOLVER_LIBPROXY(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY, SoupProxyResolverLibProxy))
+#define SOUP_PROXY_RESOLVER_LIBPROXY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY, SoupProxyResolverLibProxyClass))
+#define SOUP_IS_PROXY_RESOLVER_LIBPROXY(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY))
+#define SOUP_IS_PROXY_RESOLVER_LIBPROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY))
+#define SOUP_PROXY_RESOLVER_LIBPROXY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_PROXY_RESOLVER_LIBPROXY, SoupProxyResolverLibProxyClass))
+
+typedef struct {
+	GObject parent;
+
+} SoupProxyResolverLibProxy;
+
+typedef struct {
+	GObjectClass parent_class;
+
+} SoupProxyResolverLibProxyClass;
+
+#endif /*SOUP_PROXY_RESOLVER_LIBPROXY_H*/
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 009d702..fc285e1 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -19,6 +19,7 @@
 #include "soup-auth-digest.h"
 #include "soup-auth-manager-ntlm.h"
 #include "soup-connection.h"
+#include "soup-libproxy-features.h"
 #include "soup-marshal.h"
 #include "soup-message-private.h"
 #include "soup-message-queue.h"
@@ -165,6 +166,7 @@ soup_session_init (SoupSession *session)
 {
 	SoupSessionPrivate *priv = SOUP_SESSION_GET_PRIVATE (session);
 	SoupAuthManager *auth_manager;
+	SoupProxyURIResolver *proxy_resolver;
 
 	priv->queue = soup_message_queue_new (session);
 
@@ -189,6 +191,10 @@ soup_session_init (SoupSession *session)
 	soup_session_add_feature (session, SOUP_SESSION_FEATURE (auth_manager));
 	g_object_unref (auth_manager);
 
+	proxy_resolver = g_object_new (SOUP_TYPE_PROXY_RESOLVER_LIBPROXY, NULL);
+	soup_session_add_feature (session, SOUP_SESSION_FEATURE (proxy_resolver));
+	g_object_unref (proxy_resolver);
+
 	/* We'll be doing DNS continuously-ish while the session is active,
 	 * so hold a ref on the default GResolver.
 	 */
