Inheritance: System.IO.Stream, IDisposable
Esempio n. 1
0
        public void Execute()
        {
            Socket = AppHost.IOLoop.CreateSocket();
            Socket.Connect(RemoteAddress, RemotePort, delegate {
                Stream            = new HttpStream(this, Socket.GetSocketStream());
                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(() => {
                        if (OnResponse != null)
                        {
                            OnResponse(response);
                        }
                    });
                });
            });
        }
Esempio n. 2
0
        public HttpResponse(IHttpRequest request, ISocketStream stream)
        {
            Request = request;
            Socket  = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream         = new HttpStream(this, stream);
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Esempio n. 3
0
        public HttpResponse(IHttpRequest request, SocketStream stream)
        {
            Request = request;
            Socket = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream = new HttpStream (this, stream);
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Esempio n. 4
0
        public HttpResponse(IHttpTransaction transaction, SocketStream stream)
        {
            Transaction = transaction;
            Socket      = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream         = new HttpStream(this, stream);
            Stream.Chunked = (transaction.Request.MajorVersion > 0 && transaction.Request.MinorVersion > 0);
        }
Esempio n. 5
0
        public HttpResponse(IHttpTransaction transaction, SocketStream stream)
        {
            Transaction = transaction;
            Socket = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Stream = new HttpStream (this, stream);
            Stream.Chunked = (transaction.Request.MajorVersion > 0 && transaction.Request.MinorVersion > 0);
        }
Esempio n. 6
0
        public HttpResponse(Context context, IHttpRequest request, ITcpSocket socket)
            : base(context)
        {
            Request = request;
            Socket = socket;

            StatusCode = 200;

            WriteHeaders = true;

            Stream = new HttpStream (this, socket.GetSocketStream ());
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Esempio n. 7
0
        public HttpResponse(Context context, IHttpRequest request, Socket socket)
            : base(context)
        {
            Request = request;
            Socket  = socket;

            StatusCode = 200;

            WriteHeaders = true;

            Stream         = new HttpStream(this, socket.GetSocketStream());
            Stream.Chunked = (request.MajorVersion > 0 && request.MinorVersion > 0);
        }
Esempio n. 8
0
        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);
                    }
                });
            };
        }
Esempio n. 9
0
        public void Execute()
        {
            var remote = new IPEndPoint(IPAddress.Parse(RemoteAddress), RemotePort);

            Socket = this.Context.CreateTcpSocket(remote.AddressFamily);
            Socket.Connect(remote, delegate {
                Stream            = new HttpStream(this, Socket.GetSocketStream());
                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(Context, this, Socket);

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

                    response.Read(() => {
                        if (OnResponse != null)
                        {
                            OnResponse(response);
                        }
                    });
                });
            }, ex => {
                // TODO: figure out what to do here
            });
        }
Esempio n. 10
0
 public HttpStreamWriterWrapper(HttpStream stream)
 {
     this.stream = stream;
 }
Esempio n. 11
0
        public void Execute()
        {
            Socket = AppHost.Context.CreateSocket ();
            Socket.Connect (RemoteAddress, RemotePort, delegate {
                Stream = new HttpStream (this, Socket.GetSocketStream ());
                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 (Context, this, Socket);

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

                    response.Read (() => {
                        if (OnResponse != null) OnResponse (response);
                    });
                });
            });
        }
Esempio n. 12
0
 public HttpStreamWriterWrapper(HttpStream stream)
 {
     this.stream = stream;
 }
Esempio n. 13
0
        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);
                });
            };
        }
Esempio n. 14
0
        public void Execute()
        {
            var remote = new IPEndPoint(IPAddress.Parse (RemoteAddress), RemotePort);
            Socket = this.Context.CreateTcpSocket (remote.AddressFamily);
            Socket.Connect (remote, delegate {
                Stream = new HttpStream (this, Socket.GetSocketStream ());
                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 (Context, this, Socket);

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

                    response.Read (() => {
                        if (OnResponse != null) OnResponse (response);
                    });
                });
            }, ex => {
                // TODO: figure out what to do here
            });
        }
Esempio n. 15
0
 public HttpResponse(SocketStream stream)
 {
     Socket = stream;
     Stream = new HttpStream(this, stream);
 }
Esempio n. 16
0
 public HttpResponse(SocketStream stream)
 {
     Socket = stream;
     Stream = new HttpStream (this, stream);
 }