On Sun, Sep 13, 2009 at 4:56 PM, Ozgur <hinoglu@gmail.com> wrote:

Steve thanks for pointers. following is my final mod_django.erl with vanilla yaws :)
seems to work good

out(Arg) ->
   case proplists:get_value("static_paths", Arg#arg.opaque) of
       P when is_list(P) ->
           Sp = lists:filter(fun(Y) -> Y =/= [] end,
               lists:map(fun(X)-> string:strip(X) end, string:tokens(P, ","))),

           case lists:filter(fun(Y) -> string:rstr(Arg#arg.server_path, Y) == 1 end, Sp) of
               [_|_] ->

                   %% serve static
                   error_logger:info_msg("static serving ~p~n",[Arg#arg.server_path]),
                   {page, Arg#arg.server_path};

               _ ->

               error_logger:info_msg("dynamic serving ~p~n",[Arg#arg.server_path]),
               case yaws_cgi:call_fcgi_responder(Arg) of
                   R when is_list(R) ->
                       case proplists:get_value(status, R) of
                       404 ->
                           {page, Arg#arg.server_path}; % Let Yaws try to serve static files
                       _  -> R
                       end;

                   X -> X
               end
           end;
       _ ->

           {page, Arg#arg.server_path} % Let Yaws try to serve static files
   end.

Great, glad to hear it works for you. You might consider adding an entry to the Yaws wiki about your work.

There's one other part of your original patch that caught my eye: the increase on the FCGI timeout. Should that be boosted? Both your patch and the Rails integration wiki entry mention that the timeout is currently too low. I can make that change if needed, just let me know.

--steve