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

Strange behavior with :POST request #272

Closed
sikanhe opened this issue Jan 19, 2016 · 7 comments
Closed

Strange behavior with :POST request #272

sikanhe opened this issue Jan 19, 2016 · 7 comments

Comments

@sikanhe
Copy link
Contributor

sikanhe commented Jan 19, 2016

Hey so it seems like i am hitting some kind of bug with POST request.
In all my other languages, i can successfully make the follow request to the url(should return 403)

https://EXERW3T3UB-dsn.algolia.net/1/indexes/*/queries

but with hackney its returning 404,i think it might have something to do with the * asterisk in the url, because that is only url that has it and the only one thats causing issues with 404.

@benoitc
Copy link
Owner

benoitc commented Jan 24, 2016

Right * will be url encoded. This issue is similar to #246 . Normally the server should decode it but... I will take about that in next release.

@sikanhe
Copy link
Contributor Author

sikanhe commented Mar 20, 2016

Is there an immediate fix for this ? I just need to support "*" badly right now, could you guide me to a workaround ?

benoitc added a commit that referenced this issue Mar 21, 2016
This function allows the users to bypass default hackney strict PATH encoding
similar chromium algorithm. So they can handle servers that need a specific
encoding.

fix #277; #272, #246
@benoitc
Copy link
Owner

benoitc commented Mar 21, 2016

@sikanhe new master has now the possibility to set your own path encoding function. Normally servers are supposed to decode path correctly though... Let me know if if it works for you. I will make a new release tomorrow.

@benoitc
Copy link
Owner

benoitc commented Mar 21, 2016

addionnaly added the "*" case.

@sikanhe
Copy link
Contributor Author

sikanhe commented Mar 21, 2016

@benoitc thank you so much!

@sikanhe
Copy link
Contributor Author

sikanhe commented Mar 22, 2016

Hey I tried out the master branch, it didn't seem to recognize the function I put in as an option at all.. So i dug in the code and traced the bug to hackney_url:normalize(Url, Fun), in which the function didnt actually apply to the url, it always uses hackney_url:pathencode/1

https://github.com/benoitc/hackney/blob/master/src/hackney_url.erl#L104

So I forked it and made the change to actually use the function being passed in the argument and submitted a PR #306

@benoitc
Copy link
Owner

benoitc commented Mar 22, 2016

i merged the pr. sorry for that...

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

2 participants