Skip to content
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

URIs not Equivalent with Differently Ordered Query Strings #35

Open
oalders opened this issue Mar 3, 2017 · 3 comments
Open

URIs not Equivalent with Differently Ordered Query Strings #35

oalders opened this issue Mar 3, 2017 · 3 comments

Comments

@oalders
Copy link
Member

oalders commented Mar 3, 2017

See https://rt.cpan.org/Ticket/Display.html?id=81491

I'm wondering if rather than

sub _obj_eq {
    return overload::StrVal($_[0]) eq overload::StrVal($_[1]);
}

we should do something like

sub _obj_eq {
    return $_[0]->canonical->as_string eq $_[1]->canonical->as_string;
}

I haven't tested this, but wanted to start a discussion here.

Ping @eserte and @theory who are commenters on the original RT.

@theory
Copy link

theory commented Mar 3, 2017

@srezic had a valid point in the original RT that order might be important in determining equivalence. He said:

I think order matters here. Somebody could use a query string like

foo.bar?ordered_array=1;ordered_array=2;ordered_array=3;ordered_array=4

and expect it to be ordered.

So I can imagine sometimes wanting it to be considered equivalent and sometimes not, depending on the use-case and context. Maybe it'd make sense to add a method that compares without regard to query string ordering?

@oalders
Copy link
Member Author

oalders commented Mar 3, 2017

Is there a use case where the order of parameters actually matters? (I haven't read the RFC). I'd be inclined to ensure the params were all ordered before doing the comparison.

@genio
Copy link
Member

genio commented Mar 3, 2017

Yes, order matters. Mojo::Parameters's example should likely be followed.

11:19 <@sri> if you change order the query strings become semantically different according to the specs
11:19 <@sri> which may or may not be important, depending on the apps involved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants