etr/libhttpserver

[BUG] '+' character endpoint parsing becoming empty character

jc-juarez opened this issue · 3 comments

I was testing some requests against the server and I found that whenever I pass a '+' character it becomes an empty string, so if I call an endpoint as follows:

GET server/{arg1}

where arg1 = "Hello+World"

The server receives such argument as "Hello World"

Does it have to do with something related to regex? How can I make it to actually receive the '+' character?

I alredy tried using regex for the endpoint path as GET server/.* and still get the same result

bcsgh commented

I suspect that has something to do with application/x-www-form-urlencoded encoding that replaces spaces with +.

https://en.wikipedia.org/wiki/URL_encoding#The_application/x-www-form-urlencoded_type

So that might be WAI (but maybe it shouldn't do that anyway or have a flag to suppress it).

etr commented

Yeah. It is working as intended. The params on a GET are url encoded and "+" indicates a space unless escaped. If one is in need to pass a "+" from a client, they should escape it.