Hi all!
I started to use Hydrogen, but was very confused that such great app
couldn't work with http-proxy.
I found the ticket to add this feature
(http://www.assembla.com/spaces/hydrogen/tickets/43-add-proxy-support-for-soundlibrary-download)
dated 2008 year and made a patch.
This patch is implementing basic http-proxy support of reading
environment variables using getenv and QHttp::setProxy calls.
I have tested this patch on my GNU/Linux box only.
--
Dmitri A. Gurevich
Registered Linux User #452522
http://counter.li.org/
Index: gui/src/widgets/DownloadWidget.cpp
===================================================================
--- gui/src/widgets/DownloadWidget.cpp (revision 1911)
+++ gui/src/widgets/DownloadWidget.cpp (working copy)
@@ -23,6 +23,7 @@
#include "DownloadWidget.h"
#include <cmath>
+#include <cstdlib>
Download::Download( QWidget* pParent, const QString& download_url, const
QString& local_file )
@@ -44,6 +45,14 @@
QUrl url( __remote_url );
+ QString sEnvHttpProxy = QString( getenv( "http_proxy" ) );
+ int nEnvHttpPort = 0;
+ QString sEnvHttpUser = QString( getenv( "http_user" ) );
+ QString sEnvHttpPassword = QString( getenv( "http_password" ) );
+
+ nEnvHttpPort = sEnvHttpProxy.right( sEnvHttpProxy.length() -
sEnvHttpProxy.indexOf(':') - 1 ).toInt();
+ sEnvHttpProxy = sEnvHttpProxy.left( sEnvHttpProxy.indexOf(':') );
+
connect( &__http_client, SIGNAL( done( bool ) ), this, SLOT(
__fetch_done( bool ) ) );
connect( &__http_client, SIGNAL( dataReadProgress( int, int ) ), this,
SLOT( __fetch_progress( int, int ) ) );
connect( &__http_client, SIGNAL( requestFinished( int, bool ) ), this,
SLOT( __http_request_finished( int, bool ) ) );
@@ -57,6 +66,10 @@
__time.start();
+ if ( ( !sEnvHttpProxy.isNull() ) && ( nEnvHttpPort != 0 ) ) {
+ __http_client.setProxy( sEnvHttpProxy, nEnvHttpPort,
sEnvHttpUser, sEnvHttpPassword );
+ }
+
__http_client.setHost( url.host() );
__http_client.request( header );
}
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel