daurnimator / lua-http

HTTP Library for Lua. Supports HTTP(S) 1.0, 1.1 and 2.0; client and server.
https://daurnimator.github.io/lua-http/
MIT License
778 stars 80 forks source link

leading question mark is not ignored by query_args #194

Closed Mehgugs closed 2 years ago

Mehgugs commented 2 years ago
> for name, value in require"http.util".query_args"?a=b&c=d" do print(name, value) end
?a  b
c   d

As far as im aware, you cannot have a ? in a query string without encoding it.

daurnimator commented 2 years ago

As far as im aware, you cannot have a ? in a query string without encoding it.

You can. See RFC 3986: query = *( pchar / "/" / "?" ) i.e. a query can be made up of any path character, /, or ?.


The string you pass to query_args should be the query string, not the query string with a leading ?.