本文整理汇总了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());
}
示例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");
}
}
}
}
示例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();
}
}