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; }
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); }