Inheritance: IHttpEntity
Example #1
0
 public static HttpEntity GetHttpEntity(InMemoryRequest postRequest, string data, MediaType MediaType)
 {
     var bytes = Encoding.UTF8.GetBytes(data);
     var httpEntity = new HttpEntity(postRequest.Entity.Headers, new MemoryStream(bytes)) { ContentLength = bytes.Length };
     httpEntity.ContentType = MediaType;
     return httpEntity;
 }
 public HttpListenerResponse(HttpListenerCommunicationContext context, System.Net.HttpListenerResponse response)
 {
     _context = context;
     _nativeResponse = response;
     Headers = new HttpHeaderDictionary();
     Entity = new HttpEntity(Headers, _tempStream);
     _nativeResponse.SendChunked = false;
 }
        public OwinResponse(IOwinContext context)
        {
            var response = context.Response;

            NativeContext = response;
            Headers = new HttpHeaderDictionary();
            var delayedStream = new DelayedStream(context.Response.Body);
            Entity = new HttpEntity(Headers, delayedStream);
        }
 public HttpListenerResponse(HttpListenerCommunicationContext context, System.Net.HttpListenerResponse response)
 {
     _context = context;
     _nativeResponse = response;
     Headers = new HttpHeaderDictionary();
     // TODO: Wrap stream and send chunked when needed if write starts before sending response
     Entity = new HttpEntity(Headers, _tempStream);
     _nativeResponse.SendChunked = false;
 }
Example #5
0
        public AspNetRequest(HttpContext context)
        {
            NativeContext = context;
            Uri = NativeContext.Request.Url;
            Headers = new HttpHeaderDictionary(NativeContext.Request.Headers);

            // TODO: Finish off the new input stream that goes to the
            // WorkerRequest and bypasses asp.net completely.
            Entity = new HttpEntity(Headers, NativeContext.Request.InputStream);

            if (!string.IsNullOrEmpty(NativeContext.Request.ContentType))
                Entity.ContentType = new MediaType(NativeContext.Request.ContentType);
            CodecParameters = new List<string>();
        }
        public HttpListenerRequest(HttpListenerCommunicationContext context, System.Net.HttpListenerRequest request)
        {
            _context = context;
            _nativeRequest = request;
            Uri = _nativeRequest.Url;
            CodecParameters = new List<string>();

            Headers = new HttpHeaderDictionary(_nativeRequest.Headers);

            Entity = new HttpEntity(Headers, new HistoryStream(_nativeRequest.InputStream));

            if (!string.IsNullOrEmpty(_nativeRequest.ContentType))
                Entity.ContentType = new MediaType(_nativeRequest.ContentType);
        }
 public InMemoryRequest()
 {
     Headers = new HttpHeaderDictionary();
     Entity = new HttpEntity(Headers, new MemoryStream());
     CodecParameters = new List<string>();
 }
 public InMemoryResponse()
 {
     Headers = new HttpHeaderDictionary();
     Entity = new HttpEntity(Headers, _outputStream);
 }
 public AspNetResponse(HttpContext context)
 {
     NativeContext = context;
     Headers = new HttpHeaderDictionary();
     Entity = new HttpEntity(Headers, NativeContext.Response.OutputStream);
 }