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

QWebSocketServer checks HTTP headers without ignoring case.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.4.0
    • 5.3.0, 5.3.1
    • WebSockets
    • None
    • MacOSX, Windows, Linux
    • ea22c846b285ee4f71efc0fc050a4759880433a8

    Description

      QWebSocketServer will not accept incoming connection if HTTP headers are in lower case.
      This is similar to problem that was already reported in QTBUG-37975 that concerned source file qwebsocket_p.cpp.

      Similar problem is also in file qwebsockethandshakerequest.cpp.

      QWebSocketHandshakeRequest::readHandshake method validates incoming HTTP connection and like in bug 37975 it first collects headers in QMap<QString,QString> and then uses string literal keys to check expected values - case-sensitive compare. On should ignore case in HTTP header keys.

      A possible fix is to change line around line 229 in qwebsockethandshakerequest.cpp from

      m_headers.insertMulti(headerField.at(0), headerField.at(1));
      

      to

      m_headers.insertMulti(headerField.at(0).toLower(), headerField.at(1));
      

      and changing all string literals that act as keys to this m_headers (QMap) to be lower case.

      Attachments

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

        Activity

          People

            jotahtin Jorma Tähtinen
            jotahtin Jorma Tähtinen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: