Index: trunk/BNC/bncsocket.cpp
===================================================================
--- trunk/BNC/bncsocket.cpp	(revision 1362)
+++ trunk/BNC/bncsocket.cpp	(revision 1363)
@@ -33,6 +33,5 @@
   _socket    = 0;
   _http      = 0;
-  _buffer    = 0;
-  _eventLoop = 0;
+  connect(this, SIGNAL(quitEventLoop()), &_eventLoop, SLOT(quit()));
 }
 
@@ -43,6 +42,4 @@
   delete _socket;
   delete _http;
-  delete _buffer;
-  delete _eventLoop;
 }
 
@@ -70,5 +67,5 @@
 qint64 bncSocket::bytesAvailable() const {
   if      (_http) { 
-    return _http->bytesAvailable();
+    return _buffer.size();
   }
   else if (_socket) {
@@ -83,6 +80,12 @@
 ////////////////////////////////////////////////////////////////////////////
 bool bncSocket::canReadLine() const {
-  if      (_buffer) {
-    return _buffer->canReadLine();
+  if      (_http) {
+    cout << "canReadLine " << _buffer.size() << endl;
+    if (_buffer.indexOf('\n') != -1) {
+      return true;
+    }
+    else {
+      return false;
+    }
   }
   else if (_socket) {
@@ -97,6 +100,7 @@
 ////////////////////////////////////////////////////////////////////////////
 QByteArray bncSocket::readLine(qint64 maxlen) {
-  if      (_buffer) {
-    return _buffer->readLine(maxlen);
+  if      (_http) {
+    return "";
+    ///    return _buffer->readLine(maxlen);
   }
   else if (_socket) {
@@ -110,10 +114,15 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-bool bncSocket::waitForReadyRead(int msecs) {
-  if (_socket) {
-    return _socket->waitForReadyRead(msecs);
-  }
-  else {
-    return false;
+void bncSocket::waitForReadyRead(int msecs) {
+  if      (_http) {
+    if (bytesAvailable() > 0) {
+      return;
+    }
+    else {
+      _eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
+    }
+  }
+  else if (_socket) {
+    _socket->waitForReadyRead(msecs);
   }
 }
@@ -268,11 +277,14 @@
          << _http->errorString().toAscii().data() << endl;
   }
-  cout << _buffer->data().data();
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void bncSocket::slotReadyRead() {
-  cout << "slotReadyRead " << _buffer->size() << endl;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncSocket::slotReadyRead(const QHttpResponseHeader&) {
+  cout << "slotReadyRead " << _buffer.size() << " "
+       << _http->bytesAvailable() << endl;
+  _buffer.append(_http->readAll());
+  cout << _buffer.data();
+  emit quitEventLoop();
 }
 
@@ -285,5 +297,4 @@
          << _http->errorString().toAscii().data() << endl;
   }
-  emit quitEventLoop();
 }
 
@@ -294,6 +305,4 @@
                          int timeOut, QString& msg) {
 
-  _eventLoop = new QEventLoop();
-  connect(this, SIGNAL(quitEventLoop()), _eventLoop, SLOT(quit()));
 
   delete _http;
@@ -322,12 +331,8 @@
   connect(_http, SIGNAL(requestFinished(int, bool)), 
           this, SLOT(slotRequestFinished(int, bool)));
-
-  _buffer = new QBuffer();
-  _buffer->open(QBuffer::ReadWrite);
-  connect(_buffer, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
-
-  _http->request(request, 0, _buffer);
-
-  ///  _eventLoop->exec(QEventLoop::ExcludeUserInputEvents);
+  connect(_http, SIGNAL(readyRead(const QHttpResponseHeader&)), 
+          this, SLOT(slotReadyRead(const QHttpResponseHeader&)));
+
+  _http->request(request);
 
   cout << "before return" << endl;
Index: trunk/BNC/bncsocket.h
===================================================================
--- trunk/BNC/bncsocket.h	(revision 1362)
+++ trunk/BNC/bncsocket.h	(revision 1363)
@@ -16,5 +16,5 @@
   bool       canReadLine() const;
   QByteArray readLine(qint64 maxlen = 0);
-  bool       waitForReadyRead(int msecs = 30000);
+  void       waitForReadyRead(int msecs = 30000);
   qint64     read(char *data, qint64 maxlen);
   QAbstractSocket::SocketState state() const;
@@ -31,5 +31,5 @@
   void slotDone(bool);
   void slotRequestFinished(int, bool);
-  void slotReadyRead();
+  void slotReadyRead(const QHttpResponseHeader&);
 
  private:
@@ -40,6 +40,6 @@
   QTcpSocket* _socket;
   QHttp*      _http;      
-  QBuffer*    _buffer;
-  QEventLoop* _eventLoop;
+  QByteArray  _buffer;
+  QEventLoop  _eventLoop;
 };
 
Index: trunk/BNC/bnctabledlg.cpp
===================================================================
--- trunk/BNC/bnctabledlg.cpp	(revision 1362)
+++ trunk/BNC/bnctabledlg.cpp	(revision 1363)
@@ -39,7 +39,11 @@
  * -----------------------------------------------------------------------*/
 
+#include <iostream>
+
 #include "bnctabledlg.h"
 #include "bncgetthread.h"
 #include "bncsocket.h"
+
+using namespace std;
 
 // Constructor
@@ -210,5 +214,8 @@
     }
     else {
+      cout << "before waitForReadyRead" << endl;
       socket->waitForReadyRead(timeOut);
+      cout << "after waitForReadyRead" << " " 
+           << socket->bytesAvailable() << endl;
       if (socket->bytesAvailable() > 0) {
         continue;
