Ejemplo n.º 1
0
        private byte[] BuildHeader(ResponeCode code, HeaderOption option = null)
        {
            String2 ret = new String2(Encoding.UTF8);

            if (object.Equals(code, ResponeCode.CODE200))
            {
                ret += "HTTP/1.1 200 OK" + String2.CRLF;
            }
            else
            {
                ret += "HTTP/1.1 " + ((int)code) + " NG" + String2.CRLF;
            }
            if (option != null)
            {
                foreach (String key in option.ToResult().Keys)
                {
                    ret += key + ": " + option.ToResult()[key] + String2.CRLF;
                }
            }
            ret += "Keep-Alive: timeout=15, max=93" + String2.CRLF;
            ret += "Connection: Keep-Alive" + String2.CRLF + String2.CRLF;
            return(ret.ToBytes());
        }