In https://www.rfc-editor.org/rfc/rfc7230#section-2.7.1 with reference to https://www.rfc-editor.org/rfc/rfc3986#section-3.4 described uri format. And in particular the "query" part
The query component is indicated by the first question mark ("?") character and terminated by a number sign ("#") character or by the end of the URI.
But question mark ("?") can be a part of path as well and i can not find any notes for parsing this in rfc. Is there any standart way to do it? Or finding question mark ("?") and trimming string until sign ("#") character or its end is right way (like here)?
"?" starts the query part in any URI (not only http(s)).
If you need a "?" in the path, you'll need to percent-escape it.