Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWebSocketServer doesn't work with Chrome in norway on saturdays and sundays
QtWS25 Last Chance

QWebSocketServer doesn't work with Chrome in norway on saturdays and sundays

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stiander
    wrote on last edited by
    #1

    Hi,

    When a chrome browser is setting up a websocket connection with a QWebSocketServer, it fails with the error-message :
    WebSocket connection to 'ws://localhost:9090/' failed: Invalid UTF-8 sequence in header value.

    Works fine on recent versions of Opera, Firefox and IE

    What is strange is it worked yesterday (friday 15.08.2014). Today, saturday (16.08.2014) it doesn't work.
    Now, I've been investigating this, and I think I have found a possible reason. I think it has something to do with how the class
    QWebSocketHandshakeResponse is building it's headers. Here is how the result looks like TODAY :

    HTTP/1.1 101 Switching Protocols
    Upgrade: websocket
    Connection: Upgrade
    Sec-WebSocket-Accept: <XXXXXXXXXXXXXXXXXXXXXXXXXXXX>
    Server: wsmanas
    Access-Control-Allow-Credentials: false
    Access-Control-Allow-Methods: GET
    Access-Control-Allow-Headers: content-type
    Access-Control-Allow-Origin: *
    Date: lø, 16 aug 2014 12:29:41 GMT

    Look at the last header, Date. It contains a non-UTF-8 letter : 'ø', because saturday in norwegian is LØRDAG. Now look at how the response is being built :

    @
    response << QStringLiteral("Server: ") % serverName <<
    QStringLiteral("Access-Control-Allow-Credentials: false") <<
    QStringLiteral("Access-Control-Allow-Methods: GET") <<
    QStringLiteral("Access-Control-Allow-Headers: content-type") <<
    QStringLiteral("Access-Control-Allow-Origin: ") % origin <<
    QStringLiteral("Date: ") %
    QDateTime::currentDateTimeUtc()
    .toString(QStringLiteral("ddd, dd MMM yyyy hh:mm:ss 'GMT'"));
    @

    So the Date header is built using the QDateTime class. Looking at the toString function :

    @
    QString QDateTime::toString(const QString& format) const
    {
    return QLocale::system().toString(*this, format);
    }
    @

    it seems to me that it is not possible the change the language, for instance like this :

    @
    QLocale loc(QLocale::English, QLocale::Norway);
    QLocale::setDefault(loc);
    @

    because it's going to use the system locale anyway. Because of this, i think that QWebSocket connections is not going to work with Chrome on saturdays (LØRDAG; lø) or sundays (SØNDAG; sø).

    Is this a bug, or am I just doing it wrong? Suggestions of how to fix it?

    regards
    Stian Broen

    [edit: added missing coding tags @ SGaist]

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Looks like you may have found something. You should go to the "bug report system":http://bugreports.qt-project.org and see it's something known. If not please consider opening a new report providing all the infos you have found, it will be very helpful.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stiander
        wrote on last edited by
        #3

        Thanks, I opened a new report

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you also share the link to the report ? So other people finding this thread may get to it directly

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stiander
            wrote on last edited by
            #5

            https://bugreports.qt-project.org/browse/QTBUG-40863

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved