On Mon, Mar 24, 2014 at 12:47 PM, <yaws@poetmail.net> wrote:
I've been using a (very) old version of YAWS with a bunch of appmods
that worked nicely.

I've just installed version 1.98 and now I find my pre-compiled beam
files don't work and I'm unable to compile afresh.

Example of protect_inc.erl, source:

-module(protect_inc).
-include_lib("yaws/include/yaws_api.hrl").
-export([arg_rewrite/1]).

%% This module rewrites requests for a protected path to the
errormod_404 handler
%% Note that paths are converted to lower case and hard-coded in the
case line

arg_rewrite(Arg) ->
   Req = Arg#arg.req,
   {abs_path,Path} = Req#http_request.path,
   try yaws_api:url_decode_q_split(Path) of
     {DecPath,_Query} ->
       case string:to_lower(string:sub_string(DecPath,1,10)) ==
"/forbidden" orelse string:str(DecPath,".htaccess") > 0 of
         true ->
           Arg#arg{req = Req#http_request{path = {abs_path,"/err.php"}}};
         false ->
           Arg
       end
   catch
     exit:_ ->
       Arg
   end.

When I try c(protect_inc.erl). I get:

* 1: syntax error before: '.'

If I drop my existing (old) pre-compiled protect_inc.beam into
/usr/local/lib/yaws/ebin (and invoke it with arg_rewrite_mod =
protect_inc in the server config) I get:

Yaws process died: {{badrecord,arg},
                     [{protect_inc,arg_rewrite,1,[]},
                      {yaws_server,no_body_method,4,
                                   [{file,"yaws_server.erl"},{line,1678}]},
                      {yaws_server,aloop,4,
                                   [{file,"yaws_server.erl"},{line,1216}]},
                      {yaws_server,acceptor0,2,
                                   [{file,"yaws_server.erl"},{line,1053}]},
                      {proc_lib,init_p_do_apply,3,
                                [{file,"proc_lib.erl"},{line,239}]}]}

I'm sure the problem & solution is obvious to someone but not me
unfortunately.

The second error is due to the fact that the #arg{} record occasionally changes from release to release -- a recompile will fix that. So let's focus on the first problem instead. What version of Erlang were you using before, and what version are you trying to use now?

--steve