src/Foundation/Net/Gimela.Net.Http/Messages/ResponseWriter.cs
/// <summary>
/// Send a body to the client
/// </summary>
/// <param name="context">Context containing the stream to use.</param>
/// <param name="body">Body to send</param>
Send a body to the client
Send a body to the client
public void SendBody(IHttpContext context, Stream body)
    {
      try
      {
        body.Flush();
        body.Seek(0, SeekOrigin.Begin);
        var buffer = new byte[4196];
        int bytesRead = body.Read(buffer, 0, 4196);
        while (bytesRead > 0)
        {
          context.Stream.Write(buffer, 0, bytesRead);
          bytesRead = body.Read(buffer, 0, 4196);
        }
      }
      catch (Exception err)
      {
        Logger.Error("Failed to send body through context stream.");
        ExceptionHandler.Handle(err);
      }
    }
public void SendBody ( IHttpContext context , Stream body ) { try { body . Flush ( ) ; body . Seek ( 0 , SeekOrigin . Begin ) ; var buffer = new byte [ 4196 ] ; int bytesRead = body . Read ( buffer , 0 , 4196 ) ; while ( bytesRead > 0 ) { context . Stream . Write ( buffer , 0 , bytesRead ) ; bytesRead = body . Read ( buffer , 0 , 4196 ) ; } } catch ( Exception err ) { Logger . Error ( " " ) ; ExceptionHandler . Handle ( err ) ; } }
Send a body to the client
Send a body to the client
context
IHttpContext
Context containing the stream to use.
Context containing the stream to use .
body
Stream
Body to send
Body to send