Skip to content

Commit

Permalink
Add support for http_proxy environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ewestbrook committed Feb 3, 2011
1 parent a9db0dc commit 95bf8ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mythtv/programs/mythfrontend/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using namespace std;
#include <QWidget>
#include <QApplication>
#include <QTimer>
#include <QNetworkProxy>

#include "previewgeneratorqueue.h"
#include "mythconfig.h"
Expand Down Expand Up @@ -1302,6 +1303,18 @@ int main(int argc, char **argv)

gCoreContext->SetAppName(binname);


// Set http proxy for the application if specified in environment variable
QString var(getenv("http_proxy"));
QRegExp regex("(http://)?(.*):(\\d*)/?");
int pos = regex.indexIn(var);
if (pos > -1) {
QString host = regex.cap(2);
int port = regex.cap(3).toInt();
QNetworkProxy proxy(QNetworkProxy::HttpProxy, host, port);
QNetworkProxy::setApplicationProxy(proxy);
}

for(int argpos = 1; argpos < a.argc(); ++argpos)
{
if (!strcmp(a.argv()[argpos],"-l") ||
Expand Down

0 comments on commit 95bf8ee

Please sign in to comment.