anchor.diff:              cowboy_req:set_resp_header(<<"access-control-allow-credentials">>, <<"true">>, Req1)
       end.
   
  +get_request_data(Req, JsonP) ->
  +    case JsonP of
  +        undefined ->
  +            case cowboy_req:body(Req) of
  +                {ok, Body, Req1} ->
  +                    {ok, Body, Req1};
  +                {error, _} ->
  +                    error
  +            end;
  +        _Num ->
  +            case cowboy_req:body_qs(Req) of
  +                {ok, PostVals, Req1} ->
  +                    Data = proplists:get_value(<<"d">>, PostVals),
  +                    Data2 = binary:replace(Data, <<"\\\n">>, <<"\n">>, [global]),
  +                    Data3 = binary:replace(Data2, <<"\\\\n">>, <<"\\n">>, [global]),
  +                    {ok, Data3, Req1};
  +                {error, _} ->
  +                    error
  +            end
  +    end.
  +
   encode_polling_xhr_packets_v1(PacketList) ->
       lists:foldl(fun(Packet, AccIn) ->
           PacketLen = [list_to_integer([D]) || D <- integer_to_list(byte_size(Packet))],
  
positive.code:                     ResultLen = [ list_to_integer([D]) || D <- integer_to_list(byte_size(Result) + 1) ],
                      ResultLenBin = list_to_binary(ResultLen),
                      Result2 = <<0, ResultLenBin/binary, 255, "0", Result/binary>>,
                      HttpHeaders = stream_headers(Sid);
                  Num ->
                      ResultLenBin = integer_to_binary(byte_size(Result) + 1),
                      Rs = binary:replace(Result, <<"\"">>, <<"\\\"">>, [global]),
                      Result2 = <<"___eio[", Num/binary, "](\"", ResultLenBin/binary, ":0", Rs/binary, "\");">>,
                      HttpHeaders = javascript_headers(Sid)
              end,
  
              {ok, Req1} = cowboy_req:reply(200, HttpHeaders, <<Result2/binary>>, Req)
  
negative.code: encode_polling_json_packets_v1(PacketList, JsonP) ->
      Payload = lists:foldl(fun(Packet, AccIn) ->
          ResultLenBin = integer_to_binary(byte_size(Packet)),
          Packet2 = escape_character(Packet, <<"\\">>),
          Packet3 = escape_character(Packet2, <<"\"">>),
          Packet4 = escape_character(Packet3, <<"\\n">>),
          <<AccIn/binary, ResultLenBin/binary, ":", Packet4/binary>>
      end, <<>>, PacketList),
      <<"___eio[", JsonP/binary, "](\"", Payload/binary, "\");">>.
  
  escape_character(Data, CharBin) ->
      binary:replace(Data, CharBin, <<"\\", CharBin/binary>>, [global]).