anchor.diff:  
   
   %% @private
  +-spec do_start_server(server_ref(), list(), nksip_lib:proplist()) ->
  +    {ok, pid()} | {error, term()}.
  +
   do_start_server(Ref, Dispatch, Opts) ->
       {Proto, Ip, Port} = Ref,
       Env = {env, [{dispatch, cowboy_router:compile(Dispatch)}]},
  
positive.code:          handle_info/2]).
  -export([ranch_start_link/6, do_stop_server/1]).
  
  
  %% ===================================================================
  %% Public
  
negative.code:     nksip_webserver_sup:start_child(Spec1).
   
  %% @private
  -spec do_stop_server(server_ref()) ->
      ok | {error, term()}.
  
  do_stop_server(Ref) ->
      SupRef = {ranch_listener_sup, Ref},
      nksip_webserver_sup:terminate_child(SupRef).
  
  
  %% @private
  -spec do_update_server(server_ref(), [#app_info{}]) ->
      ok | {error, invalid_dispatch}.
  
  do_update_server(Ref, Apps) ->
      Rules = lists:flatten([
          Disp0 ||
          #app_info{index={_, AppRef}, dispatch=Disp0} <- Apps,
          AppRef == Ref
      ]),
      case get_dispatch(Rules, []) of
          {ok, Compiled} -> cowboy:set_env(Ref, dispatch, Compiled);
          error -> {error, invalid_dispatch}
      end.
  
  
  %% @private
  get_dispatch([], Acc) ->
      case catch cowboy_router:compile(Acc) of
          {'EXIT', _} -> error;
          Compiled -> lager:warning("Updated ~p", [Compiled]), {ok, Compiled}
      end;
  
  get_dispatch([{Host, Paths}|Rest], Acc) ->
      get_dispatch([{Host, [], Paths}|Rest], Acc);
  
  get_dispatch([{Host, Consts, Paths}|Rest], Acc) ->
      case lists:keytake(Host, 1, Acc) of
          false ->
              get_dispatch(Rest, [{Host, Consts, Paths}|Acc]);
          {value, {_, Consts, PrevPaths}, RestAcc} ->
              get_dispatch(Rest, [{Host, Consts, PrevPaths++Paths}|RestAcc]);
          _ ->
              % We don't allow sharing a server and host with different constraints
              error
      end.
  
  
  %% @private Gets socket options for listening connections
  