Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Rolling Notes Response Stream Contract

lodejard edited this page Nov 12, 2014 · 1 revision

Response body restart end-user api

HttpResponse.CanRestart {get{
  if (ResponseHeadersSent == true) return false;
  if (Response.Body.CanSeek == false) return false;
}}

HttpResponse.Restart {get{
  Response.Body.Position = 0;
  Response.Headers.Clear();
}}

Response body contract

Stream.CanSeek

  • return true if stream is fully buffered and restartable
  • delegating stream which can clear it's internal state should return InnerStream.CanSeek

Stream.Position {get} and Stream.Length {get}

  • return cumulative bytes written
  • delegating stream which passes writes through immediately should return InnerStream.Length
  • delegating stream which has internal buildup or alters data passing through should return cumulative Write byte count

Stream.Position {set}, Stream.Seek(..) and Stream.SetLength()

  • should throw exception for non-zero target
  • should throw exception if this.CanSeek is false
  • delegating stream should clear any internal state and call InnerStream.Position = 0
Clone this wiki locally