anchor.diff:  %% header is generated.
   %%
   %% If a strong ETag is required a user defined function for generating the
  -%% header value can be supplied. The function must accept a proplist of the
  -%% file attributes as the first argument and a second argument containing any
  -%% additional data that the function requires. The function must return a term
  -%% of the type `{weak | strong, binary()}' or `undefined'.
  +%% header value can be supplied. The function must accept a list of key/values
  +%% of the file attributes as the first argument and a second argument
  +%% containing any additional data that the function requires. The function
  +%% must return a term of the type `{weak | strong, binary()}' or `undefined'.
   %%
   %% ====  Examples ====
   %% ```
  
positive.code: 	fileinfo  :: {ok, #file_info{}} | {error, _} | error,
  	mimetypes :: {fun((binary(), T) -> [mimedef()]), T} | undefined,
  	etag_fun  :: {fun(([etagarg()], T) ->
  		undefined | {strong | weak, binary()}), T}}).
  
  %% @private Upgrade from HTTP handler to REST handler.
  init({_Transport, http}, _Req, _Opts) ->
  
negative.code: %% @private Set up initial state of REST handler.
  -spec rest_init(Req, list()) -> {ok, Req, #state{}} when Req::cowboy_req:req().
  rest_init(Req, Opts) ->
  	{_, DirectoryOpt} = lists:keyfind(directory, 1, Opts),
  	Directory = directory_path(DirectoryOpt),
  	case lists:keyfind(file, 1, Opts) of
  		false ->
  			{Filepath, Req2} = cowboy_req:path_info(Req),
  			case check_path(Filepath) of
  				ok ->
  					Filepath2 = join_paths(Directory, Filepath),
  					rest_init(Req2, Opts, Filepath2);
  				error ->
  					{ok, Req2, #state{filepath=error, fileinfo=error,
  						mimetypes=undefined, etag_fun=undefined}}
  			end;
  		{_, FileOpt} ->
  			Filepath = join_paths(Directory, filepath_path(FileOpt)),
  			rest_init(Req, Opts, Filepath)
  	end.
  
  rest_init(Req, Opts, Filepath) ->
  	Fileinfo = file:read_file_info(Filepath),
  	Mimetypes = case lists:keyfind(mimetypes, 1, Opts) of
  		false -> {fun path_to_mimetypes/2, []};
  		{_, {{M, F}, E}} -> {fun M:F/2, E};
  		{_, Mtypes} when is_tuple(Mtypes) -> Mtypes;
  		{_, Mtypes} when is_list(Mtypes) -> {fun path_to_mimetypes/2, Mtypes}
  	end,
  	EtagFun = case lists:keyfind(etag, 1, Opts) of
  		false -> {fun no_etag_function/2, undefined};
  		{_, default} -> {fun no_etag_function/2, undefined};
  		{_, {attributes, []}} -> {fun no_etag_function/2, undefined};
  		{_, {attributes, Attrs}} -> {fun attr_etag_function/2, Attrs};
  		{_, EtagOpt} -> EtagOpt
  	end,
  	{ok, Req, #state{filepath=Filepath, fileinfo=Fileinfo,
  		mimetypes=Mimetypes, etag_fun=EtagFun}}.
  
  %% @private Only allow GET and HEAD requests on files.
  -spec allowed_methods(Req, #state{})
  