anchor.diff:              case json2:decode_string(PostStr) of
                   {ok, Json} ->
                       L = yaws_api:parse_query(A),
  -                    do_op(A#arg.appmoddata, L, Json);
  +                    do_op(A#arg.appmoddata, L, Json, A);
                   _Reason ->
                       Res = {struct, [{status, "error"},
                                       {reason, "invalid json"}]},
  
positive.code:             Res = {struct, [{status, "error"},
                              {reason, "unknown sid"}]}
      end,
      {Res, NewS};
  %% http://idrott/idrott/get_all_events?sid=1234567890
  do_cmd("get_all_events", L, _Json, S) ->
      Sid = get_val("sid", L, ""),
      case get_user_by_id(Sid, S) of
          #user{} ->
              %% login successful
  
negative.code:             Res = {struct, [{status, "error"},
                              {reason, "unknown sid"}]}
      end,
      {{Res, []}, NewS};
  do_cmd(Unknown, _L, _Json, _A, S) ->
      Error = lists:flatten(io_lib:format("unknown request: ~p", [Unknown])),
      error_logger:format("~s", [Error]),
      {{{struct, [{"status", "error"}, {reason, Error}]}, []}, S}.
  
  rpcreply({Response, ExtraHeaders}) ->
      X = json2:encode(Response),
      [{header, {cache_control, "no-cache"}},
       {header, "Access-Control-Allow-Origin: *"},
       {header, "Expires: -1"}]++ExtraHeaders++[{html, X}].
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  