Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5.3
-
ae204271e (dev), c300dd841 (6.8), 87a1a7d5c (6.7), 55401b373 (tqtc/lts-6.5)
Description
I am not sure if this is a bug in QUrl or in QWebSocket, or maybe it isn't a bug at all. However, some servers don't accept GET request that doesn't start with /. For example this has no path at all:
QUrl("http://foo.bar?x=y")
and the server receives just:
GET ?x=y HTTP/1.1
And the lack of / there is considered an error with some web servers.
After doing some digging... According to:
https://datatracker.ietf.org/doc/html/rfc6455#section-3
A valid WebSocket URI has path as defined in path-abempty in URI spec, and URI spec says path-abempty is a path starting with leading / or is empty. But WebSocket uses QNetworkRequest, which in turn takes in QUrl, which as the name implies is for URLs in general and not WebSocket specific URIs. Therefore no validation is possible.
So there is a small design issue at least, but I am guessing it would probably be fine to just make it start the path with / if the path() is empty.