コード例 #1
0
ファイル: httpserver.cs プロジェクト: swax/Tornado.Net
 public HTTPConnection(IOStream stream_, IPEndPoint address_, Func<HTTPRequest, RequestHandler> request_callback_, bool no_keep_alive_ = false, bool xheaders_ = false)
 {
     stream = stream_;
     address = address_;
     request_callback = request_callback_;
     no_keep_alive = no_keep_alive_;
     xheaders = xheaders_;
     _request = null;
     _request_finished = false;
     // Save stack context here, outside of any request.  This keeps
     // contexts from one request from leaking into the next.
     _header_callback = _on_headers; //stack_context.wrap(self._on_headers);
     stream.read_until(Encoding.UTF8.GetBytes("\r\n\r\n"), _header_callback);
     _write_callback = null;
 }
コード例 #2
0
ファイル: netutil.cs プロジェクト: swax/Tornado.Net
        private void _handle_connection(Socket connection, IPEndPoint address)
        {
            //todo ssl
            /*if self.ssl_options is not None:
                assert ssl, "Python 2.6+ and OpenSSL required for SSL"
                try:
                    connection = ssl.wrap_socket(connection,
                                                 server_side=True,
                                                 do_handshake_on_connect=False,
                                                 **self.ssl_options)
                except ssl.SSLError, err:
                    if err.args[0] == ssl.SSL_ERROR_EOF:
                        return connection.close()
                    else:
                        raise
                except socket.error, err:
                    if err.args[0] == errno.ECONNABORTED:
                        return connection.close()
                    else:
                        raise*/
            
            try
            {
                IOStream stream = null;

                if(ssl_options != null)
                    ;//stream = SSLIOStream(connection, io_loop=self.io_loop)
                else
                    stream = new IOStream(connection, io_loop);
                handle_stream(stream, address);
            }
            catch(Exception ex)
            {
                logging.error("Error in connection callback", ex);
            }
        }
コード例 #3
0
ファイル: httpserver.cs プロジェクト: swax/Tornado.Net
        public override void handle_stream(IOStream stream, IPEndPoint address)
        {

            new HTTPConnection(stream, address, request_callback, no_keep_alive, xheaders);
        }
コード例 #4
0
ファイル: netutil.cs プロジェクト: swax/Tornado.Net
 public virtual void handle_stream(IOStream stream, IPEndPoint address)
 {
     // Override to handle a new `IOStream` from an incoming connection.
     throw new NotImplementedException();
 }