Exemplo n.º 1
0
        public void WriteMetadata(WriteCallback callback)
        {
            if (pending_length_cbs > 0)
            {
                return;
            }

            if (AddHeaders)
            {
                if (chunk_encode)
                {
                    HttpEntity.Headers.SetNormalizedHeader("Transfer-Encoding", "chunked");
                }
                else
                {
                    HttpEntity.Headers.ContentLength = Length;
                }
            }

            StringBuilder builder = new StringBuilder();

            HttpEntity.WriteMetadata(builder);

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

            metadata_written = true;

            var bytes = new List <ByteBuffer> ();

            bytes.Add(new ByteBuffer(data, 0, data.Length));
            var write_bytes = new SendBytesOperation(bytes.ToArray(), callback);

            SocketStream.QueueWriteOperation(write_bytes);
        }
Exemplo n.º 2
0
        public void WriteMetadata(WriteCallback callback)
        {
            StringBuilder builder = new StringBuilder();

            HttpEntity.WriteMetadata(builder);

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

            metadata_written = true;

            var bytes = new List <ArraySegment <byte> > ();

            bytes.Add(new ArraySegment <byte> (data, 0, data.Length));
            var write_bytes = new SendBytesOperation(bytes, callback);

            SocketStream.QueueWriteOperation(write_bytes);
        }
Exemplo n.º 3
0
        void WriteMetadata()
        {
            if (AddHeaders)
            {
                if (chunk_encode)
                {
                    HttpEntity.Headers.SetNormalizedHeader("Transfer-Encoding", "chunked");
                }
                else
                {
                    HttpEntity.Headers.ContentLength = Length;
                }
            }

            StringBuilder builder = new StringBuilder();

            HttpEntity.WriteMetadata(builder);

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

            metadata_written = true;

            SocketStream.Write(data);
        }