Changeset 1280 in ntrip for trunk


Ignore:
Timestamp:
Dec 6, 2008, 6:44:34 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r1277 r1280  
    226226  // Connect the Socket
    227227  // ------------------
     228  QSettings settings;
     229  QString proxyHost = settings.value("proxyHost").toString();
     230  int     proxyPort = settings.value("proxyPort").toInt();
     231 
    228232  QTcpSocket* socket = new QTcpSocket();
    229 
    230   socket->connectToHost(mountPoint.host(), mountPoint.port());
    231 
     233  if ( proxyHost.isEmpty() ) {
     234    socket->connectToHost(mountPoint.host(), mountPoint.port());
     235  }
     236  else {
     237    socket->connectToHost(proxyHost, proxyPort);
     238  }
    232239  if (!socket->waitForConnected(timeOut)) {
    233240    msg += "Connect timeout\n";
    234241    delete socket;
    235242    return 0;
    236   }
    237 
    238   // Set Proxy (application-wide)
    239   // ----------------------------
    240   QSettings settings;
    241   QString proxyHost = settings.value("proxyHost").toString();
    242 
    243   if (proxyHost.isEmpty()) {
    244     QNetworkProxy proxy(QNetworkProxy::NoProxy);
    245     QNetworkProxy::setApplicationProxy(proxy);
    246   }
    247   else {
    248     QNetworkProxy proxy(QNetworkProxy::Socks5Proxy);
    249     proxy.setHostName(proxyHost);
    250     proxy.setPort(settings.value("proxyPort").toInt());
    251     QNetworkProxy::setApplicationProxy(proxy);
    252243  }
    253244
     
    269260  hlp.setPort(mountPoint.port());
    270261  hlp.setPath(mountPoint.path());
    271   if (hlp.path().indexOf("/") != 0) {
    272     hlp.setPath("/");
    273   }
    274  
    275   QByteArray reqStr = "GET " + hlp.path().toAscii() + " HTTP/1.0\r\n" +
    276                       "User-Agent: NTRIP BNC/" AGENTVERSION "\r\n"
    277                       "Host: " + hlp.host().toAscii() + "\r\n"
    278                       + userAndPwd + "\r\n";
     262
     263  QByteArray reqStr;
     264  if ( proxyHost.isEmpty() ) {
     265    if (hlp.path().indexOf("/") != 0) {
     266      hlp.setPath("/");
     267    }
     268    reqStr = "GET " + hlp.path().toAscii() + " HTTP/1.0\r\n";
     269  } else {
     270    reqStr = "GET " + hlp.toEncoded() + " HTTP/1.0\r\n";
     271  }
     272  reqStr += "User-Agent: NTRIP BNC/" AGENTVERSION "\r\n"
     273            "Host: " + hlp.host().toAscii() + "\r\n"
     274            + userAndPwd + "\r\n";
    279275
    280276  // NMEA string to handle VRS stream
Note: See TracChangeset for help on using the changeset viewer.