﻿using System.IO;
using System.IO.Compression;
using System.Web;

namespace Kudu.Services
{
    public static class HttpRequestExtensions
    {
        public static Stream GetInputStream(this HttpRequestBase request)
        {
            var contentEncoding = request.Headers["Content-Encoding"];

            if (contentEncoding != null && contentEncoding.Contains("gzip"))
            {
                return new GZipStream(request.InputStream, CompressionMode.Decompress);
            }

            return request.InputStream;
        }
    }
}

﻿using System.IO;
using System.IO.Compression;
using System.Web;

namespace Kudu.Services
{
    public static class HttpRequestExtensions
    {
        public static Stream GetInputStream(this HttpRequestBase request)
        {
            var contentEncoding = request.Headers["Content-Encoding"];

            if (contentEncoding != null && contentEncoding.Contains("gzip"))
            {
                return new GZipStream(request.GetBufferlessInputStream(), CompressionMode.Decompress);
            }

            return request.GetBufferlessInputStream();
        }
    }
}

Use bufferless stream to improve perf and resource usage
Use bufferless stream to improve perf and resource usage

Fixes #518
