Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OwinHttpListenerResponse"/> class.
        /// Sets up the Environment with the necessary request state items.
        /// </summary>
        internal OwinHttpListenerResponse(HttpListenerContext context, CallEnvironment environment)
        {
            Contract.Requires(context != null);
            Contract.Requires(environment != null);
            _context = context;
            _response = _context.Response;
            _environment = environment;

            _requestState = RequestInProgress;

            var outputStream = new HttpListenerStreamWrapper(_response.OutputStream);
            outputStream.OnFirstWrite = ResponseBodyStarted;
            _environment.ResponseBody = outputStream;

            _environment.ResponseHeaders = new ResponseHeadersDictionary(_response);

            _onSendingHeadersActions = new List<Tuple<Action<object>, object>>();
            _environment.OnSendingHeaders = RegisterForOnSendingHeaders;
        }
 internal HttpListenerContext(HttpConnection cnc)
 {
     this.cnc = cnc;
     request  = new HttpListenerRequest(this);
     response = new HttpListenerResponse(this);
 }
Example #3
0
 internal ResponseStream(Stream stream, HttpListenerResponse response, bool ignore_errors)
 {
     this.response      = response;
     this.ignore_errors = ignore_errors;
     this.stream        = stream;
 }
 internal ResponseHeadersDictionary(HttpListenerResponse response)
     : base()
 {
     _response = response;
     Headers = _response.Headers;
 }