hackney icon indicating copy to clipboard operation
hackney copied to clipboard

Relative Location header resolution inconsistent with cURL

Open bismark opened this issue 6 years ago • 1 comments

Testing against the endpoint https://webmention.rocks/test/23/page:

iex(22)> {_, _, _, client} = :hackney.get("https://webmention.rocks/test/23/page", [], "", [follow_redirect: true])
{:ok, 404,
 [
   {"Server", "nginx/1.14.0"},
   {"Date", "Fri, 17 Aug 2018 08:02:07 GMT"},
   {"Content-Type", "text/html; charset=UTF-8"},
   {"Transfer-Encoding", "chunked"},
   {"Connection", "keep-alive"},
   {"X-Powered-By", "PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1"}
 ], #Reference<0.1512093228.3364093955.180727>}
iex(23)> :hackney.location(client)
"https://webmention.rocks/test/23/page/page/uMa8Y6xVKJ02zTp42ZgX"

cURL:

$ curl -I -L https://webmention.rocks/test/23/page
curl -I -L https://webmention.rocks/test/23/page
HTTP/2 302
server: nginx/1.14.0
date: Fri, 17 Aug 2018 08:03:41 GMT
content-type: text/html; charset=UTF-8
location: page/2SkpWMOjeRhNLr94UYOq
x-powered-by: PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1
access-control-allow-origin: *
access-control-allow-methods: GET, POST

HTTP/2 200
server: nginx/1.14.0
date: Fri, 17 Aug 2018 08:03:41 GMT
content-type: text/html; charset=UTF-8
x-powered-by: PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1
link: <webmention-endpoint/fOe2RpO1usCIgDNTr8iZ>; rel=webmention
access-control-allow-origin: *
access-control-allow-methods: GET, POST

bismark avatar Aug 17 '18 08:08 bismark

I see curl use "/" as a way to fix relative locations and step back for "page". Interresting. I may have a fix for it ready for the next release next week. Will update the ticket asap.

On Fri, Aug 17, 2018 at 10:04 AM Ryan Johnson [email protected] wrote:

Testing against the endpoint https://webmention.rocks/test/23/page:

iex(22)> {_, _, _, client} = :hackney.get("https://webmention.rocks/test/23/page", [], "", [follow_redirect: true]) {:ok, 404, [ {"Server", "nginx/1.14.0"}, {"Date", "Fri, 17 Aug 2018 08:02:07 GMT"}, {"Content-Type", "text/html; charset=UTF-8"}, {"Transfer-Encoding", "chunked"}, {"Connection", "keep-alive"}, {"X-Powered-By", "PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1"} ], #Reference<0.1512093228.3364093955.180727>} iex(23)> :hackney.location(client) "https://webmention.rocks/test/23/page/page/uMa8Y6xVKJ02zTp42ZgX"

cURL:

$ curl -I -L https://webmention.rocks/test/23/page curl -I -L https://webmention.rocks/test/23/page HTTP/2 https://webmention.rocks/test/23/pageHTTP/2 302 server: nginx/1.14.0 date: Fri, 17 Aug 2018 08:03:41 GMT content-type: text/html; charset=UTF-8 location: page/2SkpWMOjeRhNLr94UYOq x-powered-by: PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1 access-control-allow-origin: * access-control-allow-methods: GET, POST

HTTP/2 200 server: nginx/1.14.0 date: Fri, 17 Aug 2018 08:03:41 GMT content-type: text/html; charset=UTF-8 x-powered-by: PHP/5.6.36-1+ubuntu16.04.1+deb.sury.org+1 link: <webmention-endpoint/fOe2RpO1usCIgDNTr8iZ>; rel=webmention access-control-allow-origin: * access-control-allow-methods: GET, POST

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/benoitc/hackney/issues/519, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA4ojgNMM-Llk5B7IF8wcY_uQ4uYr6Iks5uRnkPgaJpZM4WBJGT .

benoitc avatar Aug 17 '18 09:08 benoitc