curl / trurl

trurl is a command line tool for URL parsing and manipulation.
https://curl.se/trurl/
Other
3.15k stars 102 forks source link

unable to selectively remove query parameters with asterisk in them #227

Closed schuelermine closed 1 year ago

schuelermine commented 1 year ago

Query parameters containing the * character cannot be effectively targeted as the wildcard matches other parameters as well. I suggest identifying %2a with *, which currently would only match a literal %2a in the original URI, as a workaround.

bagder commented 1 year ago

Browsers don't follow RFC 3986, they do their own thing.

I suggest identifying %2a with *, which currently would only match a literal %2a in the original URI, as a workaround.

I don't follow. Can you show with an example use case what you mean?

schuelermine commented 1 year ago

I mean removing *=0 when %2a is requested to be removed.

bagder commented 1 year ago

Supporting %2a for that seems a little weird unless we support the entire thing percent encoded, but then that might be odd as well.

What if we just allow backslash escaping, the way it is a little more traditionally done? Like: --trim 'query=\*' ?

bagder commented 1 year ago

Actually, a quirky work-around that already works is this: --trim 'query=**' since it will make a match of all query pairs that begin with *...

jacobmealey commented 1 year ago

What if we just allow backslash escaping, the way it is a little more traditionally done? Like: --trim 'query=*' ?

this seems like the most intuitive approach -- I don't think I ever would have tried query=** to solve this.