Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-51001

QWebSocket hang up during handshake

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 5.6.1
    • 5.5.1, 5.6.0
    • WebSockets
    • None
    • Windows, Linux, Mac
    • ba9306ec5a1271275d79b2f48ceb227f79352f33

      When opening connection QWebSocket sometimes hang up during handshake in QWebSocketPrivate::processData() due to the bad while condition: m_pSocket->bytesAvailable() is true but m_pSocket->canReadLine() is false, so processHandshake do nothing in state ReadingStatusState.

      Bug fix, that is worked for me, would be adding single line - to break while during handshake if we can't read a line, because processHandshake reads only lines (all auto tests passed with this fix):

      File: qwebsocket_p.cpp

      void QWebSocketPrivate::processData()
      {
          Q_ASSERT(m_pSocket);
          while (m_pSocket->bytesAvailable()) {
              if (state() == QAbstractSocket::ConnectingState) {
                  if (!m_pSocket->canReadLine()) break; // <-- bug fix
                  processHandshake(m_pSocket);
              } else {
                  m_dataProcessor.process(m_pSocket);
              }
          }
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kkohne Kai Köhne
            vpavlov Viacheslav
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes