You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
[Net] Fix WebSocketClient path parsing.
Recent changes to parse_url caused the client to make invalid HTTP requests if no path was specified.
This commit is contained in:
@@ -42,9 +42,9 @@ Error WebSocketClient::connect_to_url(String p_url, const Vector<String> p_proto
|
||||
_is_multiplayer = gd_mp_api;
|
||||
|
||||
String host = p_url;
|
||||
String path = "/";
|
||||
String scheme = "";
|
||||
int port = 80;
|
||||
String path;
|
||||
String scheme;
|
||||
int port = 0;
|
||||
Error err = p_url.parse_url(scheme, host, port, path);
|
||||
ERR_FAIL_COND_V_MSG(err != OK, err, "Invalid URL: " + p_url);
|
||||
|
||||
@@ -55,6 +55,9 @@ Error WebSocketClient::connect_to_url(String p_url, const Vector<String> p_proto
|
||||
if (port == 0) {
|
||||
port = ssl ? 443 : 80;
|
||||
}
|
||||
if (path.is_empty()) {
|
||||
path = "/";
|
||||
}
|
||||
return connect_to_host(host, path, port, ssl, p_protocols, p_custom_headers);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user