-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($resource): allow params in hostname
(except for IPv6 addresses)
#14906
fix($resource): allow params in hostname
(except for IPv6 addresses)
#14906
Conversation
Didn't Pete comment on this? |
@Narretz: Pete asked for a clarification, but didn't comment further iirc 😟
Good question. You can't actually, because we are encoding the leading/trailing There is also a more general bug (that could be a feature, but I don't think it is), that $resource('http://:foo/:bar').get({foo: ':bar.com', bar: 'baz'});
// --> GET http://baz.com/baz This shouldn't be a problem usually, but it may affect IPv6 URLs as param values. I will take another look at how we can address these issues. |
Any update on this one @gkalpak ? |
Not yet. Will work on it this week. |
A couple of thoughts after having looked into it again: Currently, we have the following limitations:
|
e34ad60
to
460d63d
Compare
R3.get({ed1a: 'foo'}); | ||
R3.get({}); | ||
R4.get({ed1a: 'foo'}); | ||
R4.get({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we interleave these tests so that the associated bits are near to each other?
E.g.
var R1 = $resource('http://[2620:0:861:ed1a::1]', null, null, keepSlashes);
$httpBackend.expect('GET', 'http://[2620:0:861:ed1a::1]').respond(null);
R1.get({ed1a: 'foo'});
var R2 = $resource('http://[2620:0:861:ed1a::1]/', null, null, keepSlashes);
$httpBackend.expect('GET', 'http://[2620:0:861:ed1a::1]/').respond(null);
R2.get({ed1a: 'foo'});
and so on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And similarly for the other new test?
I think this is good enough for now. Being able to insert non-IPv6 hosts via parameters is better than we had before. If someone then asks for that support we can look at it again. So let's get this PR merged. Thanks @gkalpak |
Support for IPv6 addresses (in b643f0d) was too aggressive and broke support for params in the `hostname` part of a URL. This commit restores support for params in the `hostname`, as long as it is not an IPv6 address. Fixes angular#14542
460d63d
to
b3cd8fe
Compare
b3cd8fe
to
b617b25
Compare
Support for IPv6 addresses (in b643f0d) was too aggressive and broke support for params in the `hostname` part of a URL. This commit restores support for params in the `hostname`, as long as it is not an IPv6 address. Fixes angular#14542 Closes angular#14906
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix (regression).
What is the current behavior? (You can also link to an open issue here)
Params inside the
hostname
part of a URL are ignored.See #14542.
What is the new behavior (if this is a feature change)?
Params inside the
hostname
part of a URL are not ignored (except if thehostname
is a[...]
enclosed IPv6 address).Does this PR introduce a breaking change?
Hardly.
Please check if the PR fulfills these requirements
Docs have been added / updated (for bug fixes / features)Other information:
Support for IPv6 addresses (in b643f0d) was too aggressive and broke support for params in the
hostname
part of a URL.This commit restores support for params in the
hostname
, as long as it is not an IPv6 address.Fixes #14542