Пример #1
0
        private bool HandleV5Auth(DataAdapterToStream stm)
        {
            int authCount = stm.ReadByte();
            bool foundAuth = false;

            if (authCount > 0)
            {
                byte[] authModes = GeneralUtils.ReadBytes(stm, authCount);
                foreach (byte b in authModes)
                {
                    if (b == 0)
                    {
                        foundAuth = true;
                        break;
                    }
                }
            }

            byte[] ret = new byte[2];

            ret[0] = 5;
            if (foundAuth)
            {
                ret[1] = 0;
            }
            else
            {
                ret[1] = 0xFF;
            }

            stm.Write(ret, 0, ret.Length);

            return foundAuth;
        }
Пример #2
0
 private void ReturnResponse(int no, string description, DataAdapterToStream stm)
 {
     byte[] response = Encoding.ASCII.GetBytes(String.Format("HTTP/1.0 {0} {1}\r\n\r\n", no, description));
     stm.Write(response, 0, response.Length);
 }