Project

General

Profile

Actions

Bug #1363

closed

Mozilla + IPv6 + WebSockets = not working

Added by Anonymous almost 12 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/23/2012
Due date:
% Done:

0%

Estimated time:

Description

Websockets don't function in Firefox 13.0.1 whenever I use an IPv6 address. They work in Chrome.

I'm using ::1 as the listening address.

Example:

#include <Wt/WApplication>
#include <Wt/WPushButton>

class Application: public Wt::WApplication
{
public:
    Application(const Wt::WEnvironment& env) :
            Wt::WApplication(env),
            flipflop(false)
    {
        this->button = new Wt::WPushButton("Pink", root());
        this->button->clicked().connect(this, &Application::eventHandler);
    }

    void eventHandler()
    {
        if ((this->flipflop = !this->flipflop))
            this->button->setText("Panther");
        else
            this->button->setText("Pink");
    }

private:
    bool flipflop;
    Wt::WPushButton *button;
};

Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
    return new Application(env);
}

int main(int argc, char **argv)
{
    return Wt::WRun(argc, argv, &createApplication);
}

Steps to Test:

  1. Enable WebSockets in the wt_config.xml file.
  2. Start the server listening on an IPv6 address.
  3. Load page in Firefox.
  4. Click the button.

Result:

Clicking the button doesn't do anything.

Expected Result:

The button's text toggles between "Pink" and "Panther."


Files

Wt.1363.patch (5.03 KB) Wt.1363.patch Kevin Robertson, 07/28/2012 04:23 AM
Actions #1

Updated by Kevin Robertson almost 12 years ago

I filed this bug without being logged into redmine. I'm sticking this comment in here so that you can direct a question to me.

Actions #2

Updated by Wim Dumon almost 12 years ago

Kevin,

Just made a little test: Chrome does switch to a WebSockets connection with an IPv6 Wt. FF doesn't even request to set up a websockets connection.

Before diving into this: this may be a bug in FF; do you know if FF can connect with other WebSockets implementations when using IPv6?

Wim.

Actions #3

Updated by Kevin Robertson almost 12 years ago

The issue arises whenever the URI is built using location.hostname. I don't know if the spec is clear on this and browsers implement it differently.

FF:

location.hostname = "::1"

Chrome:

location.hostname = "[::1]"

A cross-browser solution has to be formulated. location.host will return [address]:port and can be used instead of catting the hostname and port separately. That needs tested on all of the supported browsers though.

References:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=11587

https://developer.mozilla.org/en/window.location

Actions #4

Updated by Kevin Robertson over 11 years ago

Patch.

Actions #5

Updated by Koen Deforche over 11 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.3.0

Hey Kevin,

Thanks. location.host is indeed the better field in location !

Regards,

koen

Actions #6

Updated by Koen Deforche about 11 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF