-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add CORS parsing/building functions #29
Conversation
On the interface side of things, two comments: http|https should really be <<"http">> and <<"https">> because that's what we'll have on the Cowboy side of things (either are fine technically, just keeping binary because that's what we get and we don't match too often on them). Then the reference I don't understand. On the tests: Cowboy will never send input with trailing whitespace. It's cut off beforehand. That's why parse_host does a binary_to_integer directly, because at that point we can only have numbers or the input is invalid and we crash. On implementation: don't modify parse_host to attempt to reuse it. This most likely made it slower for no good reason. This module repeats itself a lot, there's no attempt at avoiding that, there's a large attempt at making the code as fast as possible instead. I'd expect parse_origin to have much of the same code as parse_host, except with extra scheme and list handling. |
According to the RFC we should generate
So, reference represents a guid here. As for the tests and implementation I got it and will fix that. |
Fair enough. But this should be written somewhere. :-) |
3a2084a
to
1bbb4aa
Compare
Ready. |
That looks very good, best PR in a long time. I don't have any further comments. It looks ready to merge, perhaps tomorrow if time allows. Thanks! |
Thanks! I will make a few more soon. :-) |
6724814
to
79d36fd
Compare
I've just added other commits to this branch. |
79d36fd
to
fd2dd30
Compare
Probably, we should rename these fuctions:
to
They will sound more natural, I think. Shall we? |
Should be the header name. |
The PR is ready then. I've also updated the Cowboy's PR. |
Yeah I will get back to you before the end of the week hopefully. Today is RabbitMQ day. :-) Thanks! |
Looking forward to it :-) |
534bc24
to
48f1cdf
Compare
I will put a couple notes, if you have time to fix, cool, otherwise just say so and i'll correct in the merge commit. |
%% names until the last segment is reached therefore we do not | ||
%% differentiate them. | ||
%% | ||
%% The following valid hosts are currently rejected: IPv6 |
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.
Should put a @todo
at the beginning of this line to not forget.
Think that's it. |
I will have done it by the end of this day. |
48f1cdf
to
d43bf62
Compare
d43bf62
to
b448c4f
Compare
It's ready. |
Thanks. I'll be on it tomorrow. |
Merged, thanks! |
Part of the Cowboy's feature 947 "Make Cowboy CORS friendly". If those changes are ok, I will update Cowboy's PR.