Changeset 1275 in ntrip
- Timestamp:
- Dec 5, 2008, 5:06:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncgetthread.cpp
r1272 r1275 226 226 // Connect the Socket 227 227 // ------------------ 228 QSettings settings;229 QString proxyHost = settings.value("proxyHost").toString();230 int proxyPort = settings.value("proxyPort").toInt();231 232 228 QTcpSocket* socket = new QTcpSocket(); 233 if ( proxyHost.isEmpty() ) { 234 socket->connectToHost(mountPoint.host(), mountPoint.port()); 235 } 236 else { 237 socket->connectToHost(proxyHost, proxyPort); 238 } 229 230 socket->connectToHost(mountPoint.host(), mountPoint.port()); 231 239 232 if (!socket->waitForConnected(timeOut)) { 240 233 msg += "Connect timeout\n"; … … 242 235 return 0; 243 236 } 237 238 // Set Proxy (application-wide) 239 // ---------------------------- 240 QSettings settings; 241 QString proxyHost = settings.value("proxyHost").toString(); 242 int proxyPort = settings.value("proxyPort").toInt(); 243 244 QNetworkProxy proxy; 245 if (proxyHost.isEmpty()) { 246 proxy.setType(QNetworkProxy::NoProxy); 247 } 248 else { 249 proxy.setType(QNetworkProxy::Socks5Proxy); 250 proxy.setHostName(proxyHost); 251 proxy.setPort(proxyPort); 252 } 253 QNetworkProxy::setApplicationProxy(proxy); 244 254 245 255 // Send Request … … 260 270 hlp.setPort(mountPoint.port()); 261 271 hlp.setPath(mountPoint.path()); 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"; 272 if (hlp.path().indexOf("/") != 0) { 273 hlp.setPath("/"); 274 } 275 276 QByteArray reqStr = "GET " + hlp.path().toAscii() + " HTTP/1.0\r\n" + 277 "User-Agent: NTRIP BNC/" AGENTVERSION "\r\n" 278 "Host: " + hlp.host().toAscii() + "\r\n" 279 + userAndPwd + "\r\n"; 275 280 276 281 // NMEA string to handle VRS stream
Note:
See TracChangeset
for help on using the changeset viewer.