示例#1
0
        public byte[] Build()
        {
            if (Header[0] == null)
            {
                return(new byte[0]);
            }

            RespondBuffer[0] = GetHeaderBytes();
            return(RespondBuffer.SelectMany(a => a).ToArray());
        }
示例#2
0
        public void SetBody(byte[] body)
        {
            if (body == null)
            {
                return;
            }

            //if (P_BodySet) /*throw new NotSupportedException("Cannot set mutiple bodies.");*/
            //    return;
            AddHeader("Content-Length", body.Length.ToString());
            RespondBuffer.Add(Encoding.UTF8.GetBytes(LineTerminator));
            RespondBuffer.Add(body);
            P_BodySet = true;
        }