GetRequest() public method

public GetRequest ( ) : Netronics.Protocol.PacketEncoder.Http.Request
return Netronics.Protocol.PacketEncoder.Http.Request
コード例 #1
0
ファイル: Client.cs プロジェクト: shlee322/Netronics
 public Client(HttpContact contact, ISocketIO socketIO)
 {
     _socketIO = socketIO;
     _channel = contact.GetChannel();
     _endPoint = contact.GetRequest().GetPath();
     _endPoint = _endPoint.Substring(0, _endPoint.Length - 3);
 }
コード例 #2
0
        public void Handle(IChannel channel, Request request)
        {
            var contact = new HttpContact(channel, request, new Response {Protocol = request.GetProtocol()});
            if(contact.GetRequest().GetProtocol() == "HTTP/1.1")
                contact.GetResponse().Protocol = "1.1";

            try
            {
                _action(contact, _rx.Split(request.GetPath()));
            }
            catch (Exception e)
            {
                contact.GetResponse().Status = 500;
                contact.GetResponse().SetContent(e.ToString());
            }

            if (contact.IsAutoSendResponse)
                channel.SendMessage(contact.GetResponse());
        }
コード例 #3
0
ファイル: SocketIO.cs プロジェクト: shlee322/Netronics
        public void XhrPolling(HttpContact contact, string[] args)
        {
            if (args.Length < 3)
                return;
            _clientLock.EnterReadLock();
            var client = GetClient(args[1]);
            _clientLock.ExitReadLock();
            if (client == null)
                return;

            if (contact.GetChannel().ToString().Substring(0, contact.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal))
                != client.GetChannel().ToString().Substring(0, client.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal)))
                return;

            if(!(client.GetChannel() is XhrChannel))
                client.Connected(new ConnectContext(new XhrChannel(contact.GetChannel().ToString().Substring(0, contact.GetChannel().ToString().IndexOf(":", StringComparison.Ordinal)))));

            var channel = client.GetChannel() as XhrChannel;
            contact.GetResponse().ContentType = "text/plain";
            if (contact.GetRequest().GetMethod() == "GET")
            {
                channel.Send(contact);
                contact.IsAutoSendResponse = false;
            }
            else
            {
                //POST일 경우 클라 -> 서버
                channel.Receive(contact.GetRequest().GetLowPostData());
                contact.GetResponse().SetContent("1");
            }
        }