anchor.diff:          _ -> nop
       end.
   
  +get_wm_option(OptName, {WMOptions, OtherOptions}) ->
  +    {Value, UpdOtherOptions} =
  +        handle_get_option_result(get_option(OptName, OtherOptions), OptName),
  +    {[{OptName, Value} | WMOptions], UpdOtherOptions}.
   
  +handle_get_option_result({undefined, Options}, Name) ->
  +    {proplists:get_value(Name, ?WM_OPTION_DEFAULTS), Options};
  +handle_get_option_result(GetOptRes, _) ->
  +    GetOptRes.
  +
  +get_wm_options(Options) ->
  +    {DispatchList, Options1} = get_option(dispatch, Options),
  +    {Name, Options2} = get_option(dispatch, Options1),
  +    {WMOptions, RestOptions} = lists:foldl(fun get_wm_option/2, {[], Options2}, ?WM_OPTIONS),
  +    {DispatchList, Name, WMOptions, RestOptions}.
   
   get_option(Option, Options) ->
       case lists:keytake(Option, 1, Options) of
          false -> {undefined, Options};
          {value, {Option, Value}, NewOptions} -> {Value, NewOptions}
       end.
  +
  +application_set_unless_env_or_undef(_Var, undefined) ->
  +    ok;
  +application_set_unless_env_or_undef(Var, Value) ->
  +    application_set_unless_env(webmachine, Var, Value).
   
   application_set_unless_env(App, Var, Value) ->
       Current = application:get_all_env(App),
  
positive.code:                                       "x-forwarded-server",
                                        "host"]],
             V /= undefined].
  
negative.code: -author('Andy Gross <andy@basho.com>').
  -export([start/1, stop/0, loop/1]).
  
  %% The `log_dir' option is deprecated, but remove it from the
  %% options list if it is present
  -define(WM_OPTIONS, [error_handler,
                       log_dir,
                       rewrite_module,
                       resource_module_option]).
  
  -define (WM_OPTION_DEFAULTS, [{error_handler, webmachine_error_handler}]).
  
  start(Options) ->
      {DispatchList, PName, WMOptions, OtherOptions} = get_wm_options(Options),
      webmachine_router:init_routes(DispatchList),
      [application_set_unless_env_or_undef(K, V) || {K, V} <- WMOptions],
      mochiweb_http:start([{name, PName}, {loop, fun loop/1} | OtherOptions]).
  
  stop() ->
      {registered_name, PName} = process_info(self(), registered_name),
  