internal HttpListenerContext(HttpConnection cnc, ILogger logger)
 {
     this.cnc = cnc;
     _logger = logger;
     request = new HttpListenerRequest(this);
     response = new HttpListenerResponse(this, _logger);
 }
Exemplo n.º 2
0
 public WebSocketSharpResponse(ILogger logger, HttpListenerResponse response, IRequest request)
 {
     _logger        = logger;
     this._response = response;
     Items          = new Dictionary <string, object>();
     Request        = request;
 }
 internal ResponseStream(Stream stream, HttpListenerResponse response, bool ignore_errors, ILogger logger, string connectionId)
 {
     this.response = response;
     this.ignore_errors = ignore_errors;
     _logger = logger;
     _connectionId = connectionId;
     this.stream = stream;
 }
Exemplo n.º 4
0
        public void CloseOutputStream(HttpListenerResponse response)
        {
            try
            {
                var outputStream = response.OutputStream;

                // This is needed with compression
                outputStream.Flush();
                outputStream.Dispose();

                response.Close();
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error in HttpListenerResponseWrapper: " + ex.Message, ex);
            }
        }
Exemplo n.º 5
0
        public void CloseOutputStream(HttpListenerResponse response)
        {
            try
            {
                var outputStream = response.OutputStream;

                // This is needed with compression
                if (outputStream is ResponseStream)
                {
                    //if (!string.IsNullOrWhiteSpace(GetHeader("Content-Encoding")))
                    {
                        outputStream.Flush();
                    }

                    outputStream.Dispose();
                }
                response.Close();
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error in HttpListenerResponseWrapper: " + ex.Message, ex);
            }
        }
Exemplo n.º 6
0
 internal static void Close(this HttpListenerResponse response, HttpStatusCode code)
 {
     response.StatusCode = (int)code;
     response.OutputStream.Close();
 }
Exemplo n.º 7
0
 internal ResponseStream(Stream stream, HttpListenerResponse response, bool ignore_errors)
 {
     this.response      = response;
     this.ignore_errors = ignore_errors;
     this.stream        = stream;
 }
Exemplo n.º 8
0
 internal ResponseStream(Stream stream, HttpListenerResponse response, bool ignore_errors)
 {
     this.response = response;
     this.ignore_errors = ignore_errors;
     this.stream = stream;
 }