Changeset 1358 in ntrip for trunk/BNC/bncsocket.cpp


Ignore:
Timestamp:
Dec 27, 2008, 4:18:43 PM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncsocket.cpp

    r1357 r1358  
    292292////////////////////////////////////////////////////////////////////////////
    293293void bncSocket::slotRequestFinished(int id, bool error) {
    294   cout << "slotRequestFinished " << id << " " << error << endl;
    295   this->deleteLater();
     294  cout << "slotRequestFinished " << id << endl;
     295  if (error) {
     296    cout << "error: " << _http->error() << " "
     297         << _http->errorString().toAscii().data() << endl;
     298  }
    296299}
    297300
     
    300303void bncSocket::slotReadyRead(const QHttpResponseHeader&) {
    301304  cout << "slotReadyRead" << endl;
     305  QByteArray buffer = _http->readAll();
     306  cout << buffer.data();
    302307}
    303308
     
    311316////////////////////////////////////////////////////////////////////////////
    312317void bncSocket::slotDone(bool error) {
    313   cout << "slotDone " << error << endl;
     318  cout << "slotDone " << endl;
     319  if (error) {
     320    cout << "error: " << _http->error() << " "
     321         << _http->errorString().toAscii().data() << endl;
     322  }
    314323}
    315324
     
    328337  _http->setSocket(_socket);
    329338
     339  _http->setHost(url.host());
     340
    330341  // Network Request
    331342  // ---------------
    332   QHttpRequestHeader request("GET", url.path());
     343  QString path = url.path();
     344  if (path.isEmpty()) {
     345    path = "/";
     346  }
     347  QHttpRequestHeader request("GET", path);
    333348  request.addValue("Host"         , url.host().toAscii());
    334349  request.addValue("Ntrip-Version", "NTRIP/2.0");
    335   request.addValue("User-Agent"   , "NTRIP BNC/1.7");
     350  request.addValue("User-Agent"   , "NTRIP BNC/" BNCVERSION);
    336351  if (!url.userName().isEmpty()) {
    337352    request.addValue("Authorization", "Basic " +
     
    349364          this, SLOT(slotSslErrors(const QList<QSslError>&)));
    350365
     366  _http->request(request);
     367
    351368  return success;
    352369}
Note: See TracChangeset for help on using the changeset viewer.