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