public void Write(byte[] buffer, int offset, int count) { if (this._HeaderFlushed) { Net.NetworkStream streamEnclosure = null; StreamEnclosureRequested?.Invoke(out streamEnclosure); if (streamEnclosure == null) { throw new Exception("Inaccessible stream enclosure to do realtime streaming on http response socket!"); } streamEnclosure.Write(buffer, offset, count); return; } this._ResponseOutput.Write(buffer, offset, count); }
public void ActivateStreaming() { if (this.IsRedirected) { throw new Exception("Not possible to activate streaming when request has been already redirected!"); } if (string.IsNullOrWhiteSpace(this.Header["Content-Length"])) { throw new Exception("Content-Length should be defined in header to activate streaming for http response!"); } Net.NetworkStream streamEnclosure = null; StreamEnclosureRequested?.Invoke(out streamEnclosure); if (streamEnclosure == null) { throw new Exception("Inaccessible stream enclosure to activate streaming on http response!"); } this.PushHeaders(streamEnclosure); }