Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

core/request : node provider only redirects URLs with protocol and host #278

Closed
sebilasse opened this issue Jan 25, 2017 · 5 comments
Closed
Assignees
Milestone

Comments

@sebilasse
Copy link

sebilasse commented Jan 25, 2017

"redirects" :
from looking at the code it seems that the node provider does not resolve the nativeResponse.headers.location against the baseUrl.

seen in the wild :
If you come from
https://stackoverflow.com/users{/userId}
you are redirected to
/users{/userId}{/userName}
and that SHOULD resolve to

https://stackoverflow.com/users{/userId}{/userName} ...

same for //stackoverflow.com/whatever where it should keep the protocol ...

@sebilasse sebilasse changed the title core/request : node provider only redirects absolute URLs core/request : node provider only redirects URLs with protocol and host Jan 25, 2017
@sebilasse
Copy link
Author

I am using

import * as URL from 'url';
/* ... */
const u = URL.parse(nativeResponse.headers.location);
const redirectUrl = (!u.host || !u.protocol) ?
    URL.resolve(response.url, nativeResponse.headers.location) : nativeResponse.headers.location;

@dylans dylans added this to the 2017.02 milestone Jan 25, 2017
@rorticus rorticus self-assigned this Feb 3, 2017
rorticus added a commit to rorticus/core that referenced this issue Feb 6, 2017
rorticus added a commit to rorticus/core that referenced this issue Feb 6, 2017
@rorticus
Copy link
Contributor

rorticus commented Feb 6, 2017

Fix for this in #261

@sebilasse
Copy link
Author

@rorticus @dylans Thanks for fixing this.
And (related to redirects) a feature request ;) :
It could be useful to store the redirected URLs in an array in the options object.
The options are returned as well and the user now knows the "URLs in beetween".

@dylans
Copy link
Member

dylans commented Feb 8, 2017

And (related to redirects) a feature request ;) :
It could be useful to store the redirected URLs in an array in the options object.
The options are returned as well and the user now knows the "URLs in beetween".

Please open a new issue for this and we'll consider how to address it, otherwise it will get lost in the noise of this issue. :)

rorticus added a commit to rorticus/core that referenced this issue Feb 9, 2017
rorticus added a commit to rorticus/core that referenced this issue Feb 10, 2017
rorticus added a commit that referenced this issue Feb 10, 2017
* Updating request library to mimic fetch API, removing dependency on streams

* Exporting correct interface file now

* Request respones now using a queing event model

* Removing arraybuffer/blob tests if the environment doesnt support them

* Removing arrayBuffer test if blob isnt supported

* Adding OPTIONS, HEAD convienence methods

* Fixing import

* Allowing for relative redirects in node provider, issue #278

* Rebasing onto latest

* Handling gzip/deflate compression in node provider issue #259

* Rebasing on latest

* Review feedback

* Moving XHR responseType back
@rorticus
Copy link
Contributor

Fixed in #261

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

No branches or pull requests

3 participants