Пример #1
0
        private static void HandleClient(TcpClient client)
        {
            ITcpClient tca = new TcpClientAdapter(client);
            string     msg = GetMessageFromClient(tca.GetClient());
            var        requestProperties = HTTPParser.ParseRequest(msg);
            Request    req  = Request.GetRequest(requestProperties);
            Response   resp = Response.From(req);

            resp.Post(client.GetStream());
        }
Пример #2
0
        public static Request GetRequest(String request)
        {
            if (String.IsNullOrEmpty(request))
            {
                return(null);
            }
            RequestHeaderProperties requestHeaderProperties = HTTPParser.ParseHttpRequest(request);

            Console.WriteLine($"{requestHeaderProperties.Type} {requestHeaderProperties.URL} @ {requestHeaderProperties.Host} \nReferer: {requestHeaderProperties.Referer}");
            return(new Request(requestHeaderProperties));
        }