-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query parameter without value is dropped #34
Comments
@PunchyRascal thanks for this. Looks like we should deal with this case. http://stackoverflow.com/questions/4557387/is-a-url-query-parameter-valid-if-it-has-no-value |
I was wondering about the keywords mechanism there, that seems to take over if there is no |
Slightly worse issue: my $uri = URI->new('http://host/foo?keyword');
$uri->query_form(foo=>'bar');
say $uri; prints And: my $uri = URI->new('http://host/foo?foo=bar');
$uri->query_keywords(['keyword']);
say $uri; prints (this breaks a few things downstream, like Paws, see pplu/aws-sdk-perl#105 (comment) ) |
If someone can put together a patch for this, we can look at getting this taken care of. |
Three proposals! They all change the interface, though ☹ I can't find a way to handle equal-less form params that round-trips and keeps the current interface. |
FWIW, this is how Mojo::URL handles it:
When mixing the formats I think this is the only sensible approach, consider the "keyword" to be a form key without a value (which is valid as 'keyword' or 'keyword=' within the & pairs) |
I think following the Mojo pattern makes sense. |
URI version would be current behaviour: perl -Ilib -MURI -E 'my $url = URI->new(shift); $url->query_form(foo => "bar"); say $url->as_string' 'http://host/foo?keyword'
http://host/foo?foo=bar proposed new behaviour: perl -Ilib -MURI -E 'my $url = URI->new(shift); $url->query_form(foo => "bar"); say $url->as_string' 'http://host/foo?keyword'
http://host/foo?keyword&foo=bar |
#65 looks sane.. what's this waiting on? (Also poking at Paws ;) |
@skaji, @simbabque and @vanHoesel , any preference for the proposed solutions? |
Is there a way to smoke all downstream dependencies ? |
I think we could set something up to test the downstream dependencies that we know about. |
I agree with @vanHoesel. The I'm not opposed to this change, once we can make sure that we're not breaking everyone's code. The test suite seems fine - the failure is just an xt test about missing Changes. |
I think we could test this out with https://metacpan.org/pod/Test::DependentModules |
I'm doing this now. |
I've tried running reverse dependency tests for our master, but ran into some difficulties. I believe parts of this needs to be done manually, and we won't be able to include this as a test that Travis could run for release testing. It is really, really slow. I'll see if I can get them all to pass on master and if I have that, I will rerun for this change. |
Any luck? |
Nope. It took a few hours and had lots of failures unfortunately. I gave up. |
We could restrict this to a small subset of modules and ensure that they still pass before and after the change. |
Can I assist here somehow in running tests ? If so, how ? |
I'm afraid I don't have the code I ran any more. Sorry. |
We could start with a GitHub workflow branched from master which can successfully install some downstream modules. That would generally be helpful anyway. |
Any news on this? Is the recommended way to subclass URI and hack one's own solution? |
Also, there's another way that's backward compatible: introduce a new value for the keywords. So $u->query_form({a => "b", c => URI::KEYWORD}); # ?a=b&c |
It looks like we had agreed on the PR to merge but we have no concept of how many downstream dependencies this would break. I think we'd need someone to test those first. |
@oalders and I have added a new workflow file for manually running the tests of a dependant module. We've gone with WWW::Mechanize in #126, but it seems there is something wrong with the workflow it never finished despite the test failing. See https://github.com/libwww-perl/URI/actions/runs/4843290328. |
This is now working. We will continue discussion in the relevant PR. |
If there is a parameter without value, e.g.
https://example.com/?foo
, then the$uri->query_form()
method (but others too) do not return thefoo
parameter at all.The text was updated successfully, but these errors were encountered: