|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
identify running under ssl?I want to make urls that point back to the current yaws server, which need to be https:// if the current request was made via ssl, but http otherwise. what's the best way to identify if the current request was made via ssl. my current strategy is to match to check if Arg#clisock matches { sslsocket, _ , _ }; is that the best way? any other tips on generating self referential urls? I'm going with the the host header if available or falling back to the config'd server name. Thanks. -- fess fess@... 626 771 0045 x 42 You've heard of studio 54, it was the cool place to be. This is like network 54. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: identify running under ssl?John 'fess' Fessenden wrote:
> I want to make urls that point back to the current yaws server, which > need to be https:// if the current request was made via ssl, but > http otherwise. Common situation, > > what's the best way to identify if the current request was made via > ssl. my current strategy is to match to check if Arg#clisock matches > { sslsocket, _ , _ }; is that the best way? > > any other tips on generating self referential urls? I'm going with > the the host header if available or falling back to the config'd > server name. > There is a lot of explicit support for this. Sorry for not not documenting it in yaws_api man page - should be done. There are 4 functions in the yaws.erl module that can be used for this. Take a look at yaws.erl - and the 4 redirect_XXX() functions. They all ought to go into yaws_api and take an #arg{} as parameter instead. /klacke ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: identify running under ssl?Claes Wikström wrote:
> There is a lot of explicit support for this. Sorry for not > not documenting it in yaws_api man page - should be done. I just added such a function to yaws_api in trunk /klacke ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: identify running under ssl?On Sep 12, 2008, at 1:04 AM, Claes Wikström wrote: > Claes Wikström wrote: > >> There is a lot of explicit support for this. Sorry for not >> not documenting it in yaws_api man page - should be done. > > I just added such a function to yaws_api in trunk Cool thanks. was about to ask "where does the SC come from in that function?" but I think i figured it out, are you missing the following: SC = get(sc), ? and I didn't realize the #sconf was available in the process dictionary. interesting. thanks again. %% Returns #redir_self{} record 1771 redirect_self(A) -> 1772 {Port, PortStr} = 1773 case {SC#sconf.rmethod, SC#sconf.ssl, SC#sconf.port} of 1774 {"https", _, 443} -> {443, ""}; 1775 {"http", _, 80} -> {80, ""}; 1776 {_, undefined, 80} -> {80, ""}; 1777 {_, undefined, Port} -> 1778 {port, [$:|integer_to_list(Port)]}; 1779 {_, _SSL, 443} -> 1780 {443, ""}; 1781 {_, _SSL, Port} -> 1782 {Port, [$:|integer_to_list(Port)]} 1783 end, 1784 H = A#arg.headers, 1785 Host = yaws:redirect_host(get(sc), H#headers.host), 1786 {Scheme, SchemeStr} = 1787 case {SC#sconf.ssl,SC#sconf.rmethod} of 1788 {_, Method} when list(Method) -> 1789 {list_to_atom(Method), Method++"://"}; 1790 {undefined,_} -> 1791 {http, "http://"}; 1792 {_SSl,_} -> 1793 {https, "https://"} 1794 end, 1795 #redir_self{host = Host, 1796 scheme = Scheme, 1797 scheme_str = SchemeStr, 1798 port = Port, 1799 port_str = PortStr}. 1800 1801 1802 1803 [ http://erlyaws.svn.sourceforge.net/viewvc/erlyaws/trunk/yaws/src/ yaws_api.erl?revision=1276&view=markup ] Powered by ViewVC 1.0.5 ViewVC Help ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
|
|
Re: identify running under ssl?John 'fess' Fessenden wrote:
> but I think i figured it out, are you missing the following: > > SC = get(sc), sloppy - fixed. /klacke ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Erlyaws-list mailing list Erlyaws-list@... https://lists.sourceforge.net/lists/listinfo/erlyaws-list |
| Free embeddable forum powered by Nabble | Forum Help |