-
Notifications
You must be signed in to change notification settings - Fork 76
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
HTTP Basic Auth + at least yaws #45
Comments
I have tried with cowboy the problem seems yaws specific. I can't think of a way to change specifically the yaws implementation. I have tried changing the simple_bridge_util to_binary function by adding in the below but it doesn't seem to be the correct way. to_binary(T) when is_tuple(T) -> If there is a way you would like to suggest Jesse I will make a pull request. Kind Regards, |
Hi Stuart, Thanks for pointing this out and looking into it. I don't have an I haven't worked much with the HTTP auth headers with any of the erlang -Jesse On Wed, Mar 25, 2015 at 10:13 AM, stuart-thackray notifications@github.com
Jesse Gumm |
Hi Jesse, I have been meaning to reply to this for a while. It is not extremely urgent I think anyways. I have gone through the yaws documentation and configuration; I have not found a way to not found a means to get the "auth headers are available in a non-preparsed way". I like how the simple bridge was updated and upgraded, for example it seems all the HTTP headers names are now being cast to binary. I am not sure what the reasons would be I can think of it would be less heavy to pass between processes (binaries), you don't have to use atoms and the limited atom table, and it is keeps consistency on the types expected by the modules making use of it. I have thought about many ways to attempt to make this case work. I think the simplest is to add a different function to simple_bridge_util called something along the lines of try_to_binary/1 where if it can't cast to binary it just returns the type that wasn't cast. If you would like to suggest if either of the above options are acceptable or make a different suggestion I will create the pull request. |
Hi Stuart, I'm thinking maybe the best approach might be to add some kind of built-in The easier alternative might be to add an api function on the order of As far as the conversion to binary and how they're stored that way, it's to I'm mostly spitballing here, as I just don't know the best approach yet. -Jesse On Thu, Apr 9, 2015 at 3:39 AM, stuart-thackray notifications@github.com
Jesse Gumm |
Thanks Jesse thanks for response, Very interesting response and still digesting it. From my initial understanding is you want all webservers to be irrelevant to nitrogen or anything else. For myself many years of using yaws I am not going to change. I would prefer that it works as yaws has it; I would prefer to change nitrogen based code than check how webserver handles it (so that why I suggested/think quicker and dirtier is better). My general thought is I would never change webservers without a reason HTTP auth wouldn't be one. So my thought/suggestion would be what I suggested i.e. being letting it pass the to_binary/1; than spend the extra computation on times to check if header was this and then normalize it specifically. I also not understanding why people would choose nitrogen or simple bridge and need to convert to something else except for inets maybe to prod kind of server, The repo is owned by you and I can change the code I pull for sure to make it work for myself (which I have previously done when I think it is not helpful to contribute for the community). I will try and create a pull request if you think one is needed and how it should be handled. Thanks. |
Hi,
I have not had this problem in previous versions of simple bridge and yaws.
At least with a fresh pull of nitrogen & when you are trying to using HTTP Basic Auth it crashes. (Below is the crash).
For reference I was able to obtain the parameters i.e. username and password using the following code previously.
I am not sure if this should be handled via sbw, yaws bridge modules or simple_bridge_util (i.e. I thought of adding "to_binary(T) when is_tuple(T) ->
T;" but this is probably not right. I will try another webserver and attempt to see if I get the same result.
=ERROR REPORT==== 25-Mar-2015::15:08:03 ===
Error in simple_bridge:make/2 - error - badarg
[{erlang,iolist_to_binary,
[{"stuart_airtime","psswd","Basic c3R1YXJ0X2FpcnRpbWU6cHNzd2Q="}],
[]},
{simple_bridge_util,to_binary,1,
[{file,"src/simple_bridge_util.erl"},{line,315}]},
{sbw,normalize_header,1,[{file,"src/sbw.erl"},{line,132}]},
{sbw,'-cache_headers/1-lc$^0/1-0-',1,[{file,"src/sbw.erl"},{line,120}]},
{sbw,'-cache_headers/1-lc$^0/1-0-',1,[{file,"src/sbw.erl"},{line,120}]},
{sbw,cache_headers,1,[{file,"src/sbw.erl"},{line,120}]},
{sbw,new,2,[{file,"src/sbw.erl"},{line,101}]},
{simple_bridge,make_nocatch,2,[{file,"src/simple_bridge.erl"},{line,94}]}]
The text was updated successfully, but these errors were encountered: