コード例 #1
0
ファイル: HttpRequest.cs プロジェクト: koush/manos
        public void Execute()
        {
            Socket = new SocketStream (AppHost.IOLoop);
            Socket.Connect (RemoteAddress, RemotePort);

            Socket.Connected += delegate {
                Stream = new HttpStream (this, Socket);

                Stream.WriteMetadata (() => {
                    HttpResponse response = new HttpResponse (Socket);

                    if (Connected != null)
                        Connected (response);
                });
            };
        }
コード例 #2
0
ファイル: HttpRequest.cs プロジェクト: JoergEg/manos
        public void Execute()
        {
            Socket = new SocketStream (AppHost.IOLoop);
            Socket.Connect (RemoteAddress, RemotePort);

            Socket.Connected += delegate {
                Stream = new HttpStream (this, Socket);
                Stream.Chunked = false;
                Stream.AddHeaders = false;

                byte [] body = GetBody ();

                if (body != null) {
                    Headers.ContentLength = body.Length;
                    Stream.Write (body, 0, body.Length);
                }

                Stream.End (() => {
                    HttpResponse response = new HttpResponse (this, Socket);

                    response.OnCompleted += () => {
                        if (OnResponse != null)
                            OnResponse (response);
                    };

                    response.Read ();
                });
            };
        }