anchor.diff:          ok ->
               ok;
           error ->
  -            error_logger:error_msg("Invalid upgrade header", []),
  +            case erlang:function_exported(CallbackMod, handle_bad_header, 2) of
  +                true ->
  +                    CallbackMod:handle_bad_header(upgrade, Arg);
  +                false ->
  +                    error_logger:error_msg("Invalid upgrade header", [])
  +            end,
               deliver_xxx(Arg#arg.clisock, 400),
               exit(normal)
       end,
  
positive.code:         ok ->
              ok;
          error ->
              error_logger:error_msg("Invalid connection header", []),
              deliver_xxx(Arg#arg.clisock, 400),
              exit(normal)
      end,
  
negative.code:         ok ->
              ok;
          error ->
              case erlang:function_exported(CallbackMod, handle_bad_header, 2) of
                  true ->
                      CallbackMod:handle_bad_header(origin, Arg);
                  false ->
                      error_logger:error_msg("Expected origin ~p but found ~p",
                                              [OriginOpt, Origin])
              end,
              deliver_xxx(Arg#arg.clisock, 403),
              exit(normal)
      end,
  