Ejemplo n.º 1
0
        public static void Post(TlsConnection connection, string request, string body)
        {
            StringBuilder builder = new StringBuilder("P ", request.Length + body.Length + 24);

            builder.Append(request);
            builder.Append(" STS/1.0\r\nl:");
            builder.Append(body.Length);
            builder.Append("\r\n\r\n");
            builder.Append(body);

            byte[] data = Encoding.ASCII.GetBytes(builder.ToString());

            if (connection.SendEncrypted)
            {
                TlsResponse.Message(connection, ref data);
            }
        }
Ejemplo n.º 2
0
        private static void Send(TlsConnection connection, string header, string response)
        {
            StringBuilder builder = new StringBuilder(header, header.Length + response.Length + 24);

            builder.Append("\r\nl:");
            builder.Append(response.Length);
            builder.Append("\r\ns:");
            builder.Append(connection.StsSequence);
            builder.Append("R\r\n\r\n");
            builder.Append(response);

            byte[] data = Encoding.ASCII.GetBytes(builder.ToString());

            if (connection.SendEncrypted)
            {
                TlsResponse.Message(connection, ref data);
            }
            else
            {
                connection.Send(data);
            }
        }