当前位置: 首页>>代码示例>>C#>>正文


C# IHttpRequest.GetBuffer方法代码示例

本文整理汇总了C#中IHttpRequest.GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# IHttpRequest.GetBuffer方法的具体用法?C# IHttpRequest.GetBuffer怎么用?C# IHttpRequest.GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHttpRequest的用法示例。


在下文中一共展示了IHttpRequest.GetBuffer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RequestHeaderAvailable

        public override void RequestHeaderAvailable( IHttpRequest request, ISessionContext context )
        {
            ServiceLog.Logger.Verbose(
                () => string.Format(
                    "{0}\r\n=====existing conn======\r\n{1}\r\n========================\r\n",
                    context.Id, Encoding.UTF8.GetString(request.GetBuffer())));

            context.SendServerData(request.GetBuffer());
        }
开发者ID:williamoneill,项目名称:Gallatin,代码行数:9,代码来源:ConnectedState.cs

示例2: RequestHeaderAvailable

        public override void RequestHeaderAvailable( IHttpRequest request, ISessionContext context )
        {
            Contract.Requires(context.ClientConnection != null);

            ServiceLog.Logger.Verbose(
                () => string.Format(
                    "{0}\r\n========================\r\n{1}\r\n========================\r\n",
                    context.Id, Encoding.UTF8.GetString(request.GetBuffer())));

            //string filter = _filter.EvaluateConnectionFilters(request, context.ClientConnection.ConnectionId);

            //if (filter != null)
            //{
            //    ServiceLog.Logger.Info("{0} Connection filtered. Sending response to client.", context.Id);
            //    context.SendClientData(Encoding.UTF8.GetBytes(filter));
            //    context.ChangeState(SessionStateType.Unconnected);
            //}
            //else
            {
                if (request.IsSsl)
                {
                    context.ChangeState(SessionStateType.Https);
                }
                else
                {
                    string host;
                    int port;

                    if (SessionStateUtils.TryParseAddress(request, out host, out port))
                    {
                        ServiceLog.Logger.Info("{0} Attempting to connect to remote host: [{1}] [{2}]", context.Id, host, port);

                        context.BeginConnectToRemoteHost(host, port);
                    }
                    else
                    {
                        throw new InvalidDataException("Unable to parse host address from HTTP request");
                    }
                }

            }
        }
开发者ID:williamoneill,项目名称:Gallatin,代码行数:42,代码来源:ClientConnectingState.cs

示例3: HandleServerConnect

        private void HandleServerConnect( bool success, IHttpRequest request )
        {
            ServiceLog.Logger.Verbose( "{0} ClientSession -- handle server connect", Id );

            try
            {
                // Send the header before releasing the connect event. This ensures that the header is sent before
                // any additional data in the HTTP request body
                _dispatcher.SendServerData( request.GetBuffer(), HandleServerSend );

                _connectToServerEvent.Set();

                if ( !success )
                {
                    ServiceLog.Logger.Warning( "{0} Unable to connecto to remote host. Facade returned false.", Id );
                    Reset();
                }
            }
            catch ( Exception ex )
            {
                ServiceLog.Logger.Exception( string.Format( "{0} Unhandled exception connecting to remote host.", Id ), ex );
                Reset();
            }
        }
开发者ID:williamoneill,项目名称:Gallatin,代码行数:24,代码来源:ClientSession.cs


注:本文中的IHttpRequest.GetBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。