anchor.diff:  	[{V, fun() -> R = digits(V) end} || {V, R} <- Tests].
   
   urldecode_test_() ->
  -	Tests = [
  -		{<<" ">>, <<"%20">>},
  -		{<<" ">>, <<"+">>},
  -		{<<0>>, <<"%00">>},
  -		{<<255>>, <<"%fF">>}
  -	],
  -	[{I, ?_assertEqual(E, urldecode(I))} || {E, I} <- Tests].
  +	U = fun urldecode/2,
  +	[?_assertEqual(<<" ">>, U(<<"%20">>, crash)),
  +	 ?_assertEqual(<<" ">>, U(<<"+">>, crash)),
  +	 ?_assertEqual(<<0>>, U(<<"%00">>, crash)),
  +	 ?_assertEqual(<<255>>, U(<<"%fF">>, crash)),
  +	 ?_assertEqual(<<"123">>, U(<<"123">>, crash)),
  +	 ?_assertEqual(<<"%i5">>, U(<<"%i5">>, skip)),
  +	 ?_assertEqual(<<"%5">>, U(<<"%5">>, skip)),
  +	 ?_assertError(badarg, U(<<"%i5">>, crash)),
  +	 ?_assertError(badarg, U(<<"%5">>, crash))
  +	].
  +
  +urlencode_test_() ->
  +	U = fun urlencode/2,
  +	[?_assertEqual(<<"%ff%00">>, U(<<255,0>>, [])),
  +	 ?_assertEqual(<<"%FF%00">>, U(<<255,0>>, [upper])),
  +	 ?_assertEqual(<<"+">>, U(<<" ">>, [])),
  +	 ?_assertEqual(<<"%20">>, U(<<" ">>, [noplus])),
  +	 ?_assertEqual(<<"aBc">>, U(<<"aBc">>, [])),
  +	 ?_assertEqual(<<".-~_">>, U(<<".-~_">>, [])),
  +	 ?_assertEqual(<<"%ff+">>, urlencode(<<255, " ">>))
  +	].
   
   -endif.
  
positive.code: unhex(C) when C >= $A, C =< $F -> C - $A + 10;
  unhex(C) when C >= $a, C =< $f -> C - $a + 10;
  unhex(_) -> error.
  
  %% Tests.
  
  
negative.code: 	digits/1, token/2, token_ci/2, quoted_string/2]).
  
  %% Interpretation.
  -export([connection_to_atom/1, urldecode/1, urldecode/2, urlencode/1,
  	urlencode/2]).
  
  -include("include/http.hrl").
  -include_lib("eunit/include/eunit.hrl").
  