anchor.diff:          Packet ->
               {reply, {text, Packet}, Req, State}
       end.
  +
  +enable_cors(Req) ->
  +    case cowboy_req:header(<<"origin">>, Req) of
  +        {undefined, _} ->
  +            Req;
  +        {Origin, _} ->
  +            Req1 = cowboy_req:set_resp_header(<<"access-control-allow-origin">>, Origin, Req),
  +            cowboy_req:set_resp_header(<<"access-control-allow-credentials">>, <<"true">>, Req1)
  +    end.
positive.code: -record(http_state, {action, config, sid, heartbeat_tref, messages, pid, version}).
  
  init({_, http}, Req, [Config]) ->
      {PathInfo, _} = cowboy_req:path_info(Req),
      case PathInfo of
          [<<"1">>] ->
              {ok, Req, #http_state{action = create_session, config = Config, version = 0}};
          [<<"1">>, <<"xhr-polling">>, Sid] ->
              handle_polling(Req, Sid, Config, 0);
          [<<"1">>, <<"websocket">>, _Sid] ->
              {upgrade, protocol, cowboy_websocket};
          _ ->
              {Sid, _} = cowboy_req:qs_val(<<"sid">>, Req),
              {Transport, _} = cowboy_req:qs_val(<<"transport">>, Req),
  
              case {Transport, Sid} of
                  {<<"polling">>, undefined} ->
                      {ok, Req, #http_state{action = create_session, config = Config, version = 1}};
                  {<<"polling">>, _} when is_binary(Sid) ->
                      handle_polling(Req, Sid, Config, 1);
                  {<<"websocket">>, _} ->
                      {upgrade, protocol, cowboy_websocket};
                  _ ->
                      {ok, Req, #http_state{config = Config}}
              end
      end.
  
  
negative.code:     end.
  
  text_headers() ->
      [
          {<<"content-Type">>, <<"text/plain; charset=utf-8">>}
      ].
  
  stream_headers() ->
      [
          {<<"content-Type">>, <<"application/octet-stream">>}
      ].
  
  reply_messages(Req, Messages, _Config = #config{protocol = Protocol}, SendNop) ->
  