cgi icon indicating copy to clipboard operation
cgi copied to clipboard

Unable to read query params in a POST method

Open LevitatingBusinessMan opened this issue 9 months ago • 2 comments

The current logic around handling query params is flawed.

Parameters are only drawn from the query string on GET or HEAD requests.

https://github.com/ruby/cgi/blob/master/lib/cgi/core.rb#L661-L699

LevitatingBusinessMan avatar Mar 15 '25 23:03 LevitatingBusinessMan

The correct solution would to not draw the parameters either from the POST_DATA, stdin or the QUERY_STRING depending on context.

I think there should be independent variables for POST/form data and the query paramaters. Something like @form and @params.

LevitatingBusinessMan avatar Mar 15 '25 23:03 LevitatingBusinessMan

For now I am working with this patch: https://github.com/LevitatingBusinessMan/cgi/commit/e0501efab6f023a987081be60884090547554a17

LevitatingBusinessMan avatar Mar 16 '25 00:03 LevitatingBusinessMan