[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3970: Tor support added for webViewTor in HerdictWebReporterPanel. (vidalia/branches/extension-api/src/vidalia/HerdictWebReporterPlugin)
Author: tyree731
Date: 2009-07-22 17:38:51 -0400 (Wed, 22 Jul 2009)
New Revision: 3970
Modified:
vidalia/branches/extension-api/src/vidalia/HerdictWebReporterPlugin/HerdictWebReporterPanel.cpp
Log:
Tor support added for webViewTor in HerdictWebReporterPanel. Need to make sure DNS requests go through Tor as well.
Modified: vidalia/branches/extension-api/src/vidalia/HerdictWebReporterPlugin/HerdictWebReporterPanel.cpp
===================================================================
--- vidalia/branches/extension-api/src/vidalia/HerdictWebReporterPlugin/HerdictWebReporterPanel.cpp 2009-07-22 00:30:19 UTC (rev 3969)
+++ vidalia/branches/extension-api/src/vidalia/HerdictWebReporterPlugin/HerdictWebReporterPanel.cpp 2009-07-22 21:38:51 UTC (rev 3970)
@@ -16,6 +16,9 @@
#include "HerdictWebReporterPanel.h"
+#include <QHostAddress>
+#include <QNetworkAccessManager>
+#include <QNetworkProxy>
#include <QUrl>
HerdictWebReporterPanel::HerdictWebReporterPanel(VidaliaPluginInterface* parent)
@@ -23,6 +26,19 @@
{
ui.setupUi(this);
+ /* Proxy hostname and port */
+ QHostAddress address(QHostAddress::LocalHost);
+ QString hostname = address.toString();
+ quint16 port = 9050;
+
+ /* Create a network proxy for the Tor webview and a NAM to use it. */
+ QNetworkProxy torProxy(QNetworkProxy::Socks5Proxy, hostname, port);
+ QNetworkAccessManager* networkAccessManager = new QNetworkAccessManager(this);
+ networkAccessManager->setProxy(torProxy);
+
+ /* Make the Tor Web View use this network access manager */
+ ui.webViewTor->page()->setNetworkAccessManager(networkAccessManager);
+
/* Connect button actions and URL actions to the WebView widgets. */
connect(ui.buttonBack, SIGNAL(clicked()),
ui.webViewPlain, SLOT(back()));
@@ -35,7 +51,7 @@
ui.webViewTor, SLOT(forward()));
connect(ui.buttonRefresh, SIGNAL(clicked()),
- ui.webViewPlain, SLOT(refresh()));
+ ui.webViewPlain, SLOT(reload()));
connect(ui.buttonRefresh, SIGNAL(clicked()),
ui.webViewTor, SLOT(reload()));