Open Bug 1767376 Opened 2 years ago Updated 2 years ago

Firefox aborts websocket connection if server reports as HTTP/1.0

Categories

(Core :: Networking: WebSockets, enhancement, P3)

Firefox 99
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: bugzilla, Unassigned)

References

()

Details

(Whiteboard: [necko-triaged])

Steps to reproduce:

Establish a websocket connection to a server that claims to be at HTTP/1.0

Actual results:

Firefox closed the connection when it received a perfectly valid Upgrade response but with the version being HTTP/1.0.

Expected results:

Firefox should've proceeded with the WebSocket Upgrade, as Chrome would've done.

The Bugbug bot thinks this bug should belong to the 'Core::Networking: WebSockets' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: WebSockets
Product: Firefox → Core

I am not sure if we want to support this, since upgrade header is not defined in http/1.0 spec.
Anne, do you think if there is any concern about supporting websocket for http/1.0?
Thanks.

Flags: needinfo?(annevk)

I suspect that in practice it's fine and web compatibility matters more than the current state of standards. If we want to align with Chrome it might be good to test other values there such as HTTP/0.9 101, HTTP/1.9 101, HTTP/1.10 101, HTTP/2.0 101, etc. I filed a specification issue to get this better defined there.

Flags: needinfo?(annevk)

I have tried it with a custom server and it seems Chrome does not discriminate HTTP version at all, but Firefox will only establish a connection if 1.X and X != 0.

In testing this, I have also discovered that in the case of 0.X, Firefox takes a really long time to actually error — I am not familiar with the HTTP/0.9 protocol, so it might be a mistake on my part.

Server:

std::string cont = "HTTP";
cont.append(req.path);
cont.append(" 101\r\nConnection: Upgrade\r\nUpgrade: websocket\r\nSec-WebSocket-Accept: ");
cont.append(hashWebSocketKey(key_entry->second));
cont.append("\r\n\r\n");
s.send(cont);

srv.wsRecv(s);

Client:

new WebSocket("wss://localhost/0.9")

Hope this helps.

Severity: -- → N/A
Priority: -- → P3
Whiteboard: [necko-triaged]
You need to log in before you can comment on or make changes to this bug.