Strip query string when parsing HTTP request line for path

(cherry picked from commit 91477cd4a9)
This commit is contained in:
Haoyu Qiu 2021-06-25 00:20:28 +08:00 committed by Rémi Verschelde
parent c952201d97
commit 38e0ca9b47
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -136,8 +136,11 @@ public:
// Wrong protocol
ERR_FAIL_COND_MSG(req[0] != "GET" || req[2] != "HTTP/1.1", "Invalid method or HTTP version.");
const String req_file = req[1].get_file();
const String req_ext = req[1].get_extension();
const int query_index = req[1].find_char('?');
const String path = (query_index == -1) ? req[1] : req[1].substr(0, query_index);
const String req_file = path.get_file();
const String req_ext = path.get_extension();
const String cache_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("web");
const String filepath = cache_path.plus_file(req_file);