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

Wrong symbols inside text error generated by websockets subsystem

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • None
    • 5.10.0
    • WebSockets
    • None

    Description

      Some minor issue.
      In case of websocket connection error QWebSocket::errorString() can return a string like that:
      QWebSocketPrivate::processHandshake: Unhandled http status code: 403 (Forbidden\r\n).

      Those '\r\n' wasn't stripped from HTTP response status line and looks quite ugly inside logging.

      This small patch can deal with this problem:

      diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
      index dda20f7..ba3ea8f 100644
      --- a/src/websockets/qwebsocket_p.cpp
      +++ b/src/websockets/qwebsocket_p.cpp
      @@ -935,7 +935,7 @@ static bool parseStatusLine(const QByteArray &status, int *majorVersion, int *mi
       
           bool ok;
           *statusCode = code.toInt(&ok);
      -    *reasonPhrase = QString::fromLatin1(status.constData() + j + 1);
      +    *reasonPhrase = QString::fromLatin1(status.constData() + j + 1).trimmed();
       
           return ok && uint(*majorVersion) <= 9 && uint(* minorVersion) <= 9;
       }
      

      Attachments

        For Gerrit Dashboard: QTBUG-67424
        # Subject Branch Project Status CR V

        Activity

          People

            kurt.pattyn Kurt Pattyn
            shuras109 Aleksandr Sbitnev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes