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

QWebsocketHandshakeRequest::readHandshake() fails with IPV6 address

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.6.3, 5.9.0 Beta 2
    • 5.5.1, 5.6.3, 5.7.2, 5.8.0 RC
    • WebSockets
    • None
    • 670266a075c7c312c6a7f9465298bfec0b968ee2

    Description

      The QWebSocketHandshakeRequest::readHandshake() method is use indexOf(":") to find the port number, but the IPv6 address also uses the same colon notation (e.g http://[some:ipv6::address]:port).
      Therefore, we need to find the last colon character to get the port number.

      — qwebsockethandshakerequest.cpp 2016-11-28 23:54:05.575851091 +0800
      +++ qwebsockethandshakerequest.patch.cpp 2016-11-28 23:53:52.675850649 +0800
      @@ -269,7 +269,7 @@
      if (m_requestUrl.isRelative()) {
      // see http://tools.ietf.org/html/rfc6455#page-17
      // No. 4 item in "The requirements for this handshake"

      • int idx = host.indexOf(QStringLiteral(":"));
        + int idx = host.lastIndexOf(QStringLiteral(":"));
        bool ok = false;
        int port = 0;
        if (idx != -1) {

      Attachments

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

        Activity

          People

            liaqi Liang Qi
            brian.li Brian Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes