All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpGuiTools::HttpProxyScript Class Reference

Brief description of class still missing. More...

#include <HttpProxyScript.h>

List of all members.

Public Member Functions

 HttpProxyScript (const QString &content)
QList< HttpProxyproxies (const QUrl &url)
 ~HttpProxyScript ()

Detailed Description

Brief description of class still missing.

Specifications from https://calomel.org/proxy_auto_config.html. Helpful information at http://findproxyforurl.com. dateRange() and timeRange() inspired from pac_utils.js shipped with pactester (http://code.google.com/p/pactester).


Constructor & Destructor Documentation

QGpGuiTools::HttpProxyScript::HttpProxyScript ( const QString &  content)

Description of constructor still missing

References TRACE.

  {
    TRACE;
    _script=content;
    _engine=new QScriptEngine;

    QScriptValue f;
    f=_engine->newFunction(isPlainHostName);
    _engine->globalObject().setProperty("isPlainHostName", f);
    f=_engine->newFunction(dnsDomainIs);
    _engine->globalObject().setProperty("dnsDomainIs", f);
    f=_engine->newFunction(localHostOrDomainIs);
    _engine->globalObject().setProperty("localHostOrDomainIs", f);
    f=_engine->newFunction(isResolvable);
    _engine->globalObject().setProperty("isResolvable", f);
    f=_engine->newFunction(isInNet);
    _engine->globalObject().setProperty("isInNet", f);
    f=_engine->newFunction(dnsResolve);
    _engine->globalObject().setProperty("dnsResolve", f);
    f=_engine->newFunction(myIpAddress);
    _engine->globalObject().setProperty("myIpAddress", f);
    f=_engine->newFunction(dnsDomainLevels);
    _engine->globalObject().setProperty("dnsDomainLevels", f);
    f=_engine->newFunction(shExpMatch);
    _engine->globalObject().setProperty("shExpMatch", f);
    f=_engine->newFunction(weekdayRange);
    _engine->globalObject().setProperty("weekdayRange", f);
    f=_engine->newFunction(dateRange);
    _engine->globalObject().setProperty("dateRange", f);
    f=_engine->newFunction(timeRange);
    _engine->globalObject().setProperty("timeRange", f);
  }

Description of destructor still missing

References TRACE.

  {
    TRACE;
    delete _engine;
  }

Member Function Documentation

QList< HttpProxy > QGpGuiTools::HttpProxyScript::proxies ( const QUrl &  url)

References TRACE.

  {
    TRACE;
    QList<HttpProxy> list;
    QString script(_script);
    script+=QString("\nFindProxyForURL(\"%1\", \"%2\");").arg(url.toString()).arg(url.host());
    QScriptValue result=_engine->evaluate(script);
    if(!_engine->hasUncaughtException()) {
      QStringList entries=result.toString().split(";");
      foreach(QString entry, entries) {
        entry=entry.trimmed();
        if(entry.startsWith("PROXY")) {
          list.append(HttpProxy(entry.mid(6)));
        } else if(entry.startsWith("DIRECT")) {
          list.append(HttpProxy());
        }
      }
    }
    return list;
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines