コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BodyDecoder"/> class.
 /// </summary>
 /// <param name="decoderService">The decoder service.</param>
 /// <param name="bufferSize">Buffer size of each buffer in the pool. Read the remarks at <see cref="BodyDecoder"/></param>
 /// <param name="sizeLimit">Maximum size of the body in bytes. Larger content will generate a <see cref="HttpStatusCode.RequestEntityTooLarge"/> response which will
 /// be sent back to the client.</param>
 public BodyDecoder(IBodyDecoder decoderService, int bufferSize, int sizeLimit)
 {
     if (decoderService == null) throw new ArgumentNullException("decoderService");
     _decoderService = decoderService;
     _bufferSize = bufferSize;
     _sizeLimit = sizeLimit;
     _bufferPool = new BufferSliceStack(1000, bufferSize);
 }
コード例 #2
0
 public HttpMessageDecoder(IBodyDecoder decoder)
 {
     _headerParser = new HeaderParser();
     _headerParser.HeaderParsed = OnHeader;
     _headerParser.RequestLineParsed = OnRequestLine;
     _headerParser.Completed = OnHeaderParsed;
     BodyDecoder = decoder;
     _messageReceived = delegate { };
 }
コード例 #3
0
 public HttpMessageDecoder(IBodyDecoder decoder)
 {
     _headerParser = new HeaderParser();
     _headerParser.HeaderParsed      = OnHeader;
     _headerParser.RequestLineParsed = OnRequestLine;
     _headerParser.Completed         = OnHeaderParsed;
     BodyDecoder      = decoder;
     _messageReceived = delegate { };
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BodyDecoder"/> class.
 /// </summary>
 /// <param name="decoderService">The decoder service.</param>
 /// <param name="bufferSize">Buffer size of each buffer in the pool. Read the remarks at <see cref="BodyDecoder"/></param>
 /// <param name="sizeLimit">Maximum size of the body in bytes. Larger content will generate a <see cref="HttpStatusCode.RequestEntityTooLarge"/> response which will
 /// be sent back to the client.</param>
 public BodyDecoder(IBodyDecoder decoderService, int bufferSize, int sizeLimit)
 {
     if (decoderService == null)
     {
         throw new ArgumentNullException("decoderService");
     }
     _decoderService = decoderService;
     _bufferSize     = bufferSize;
     _sizeLimit      = sizeLimit;
     _bufferPool     = new BufferSliceStack(1000, bufferSize);
 }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BodyDecoder"/> class.
        /// </summary>
        /// <param name="decoderService">The decoder service.</param>
        /// <param name="bufferSliceStack">Used to provide buffers used when decoding the body</param>
        /// <param name="sizeLimit">Maximum size of the body in bytes. Larger content will generate a <see cref="HttpStatusCode.RequestEntityTooLarge"/> response which will
        /// be sent back to the client.</param>
        public BodyDecoder(IBodyDecoder decoderService, IBufferSliceStack bufferSliceStack, int sizeLimit)
        {
            if (decoderService == null) throw new ArgumentNullException("decoderService");
            if (bufferSliceStack == null) throw new ArgumentNullException("bufferSliceStack");
            _decoderService = decoderService;
            _sizeLimit = sizeLimit;
            _bufferPool = bufferSliceStack;

            var buffer = bufferSliceStack.Pop();
            _bufferSize = buffer.Count;
            bufferSliceStack.Push(buffer);
        }
コード例 #6
0
 /// <summary>
 /// Add another handlers.
 /// </summary>
 /// <param name="mimeType">Mime type</param>
 /// <param name="decoder">The decoder implementation. Must be thread safe.</param>
 public void Add(string mimeType, IBodyDecoder decoder)
 {
     if (mimeType == null)
     {
         throw new ArgumentNullException("mimeType");
     }
     if (decoder == null)
     {
         throw new ArgumentNullException("decoder");
     }
     _decoders[mimeType] = decoder;
 }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BodyDecoder"/> class.
        /// </summary>
        /// <param name="decoderService">The decoder service.</param>
        /// <param name="bufferSliceStack">Used to provide buffers used when decoding the body</param>
        /// <param name="sizeLimit">Maximum size of the body in bytes. Larger content will generate a <see cref="HttpStatusCode.RequestEntityTooLarge"/> response which will
        /// be sent back to the client.</param>
        public BodyDecoder(IBodyDecoder decoderService, IBufferSliceStack bufferSliceStack, int sizeLimit)
        {
            if (decoderService == null)
            {
                throw new ArgumentNullException("decoderService");
            }
            if (bufferSliceStack == null)
            {
                throw new ArgumentNullException("bufferSliceStack");
            }
            _decoderService = decoderService;
            _sizeLimit      = sizeLimit;
            _bufferPool     = bufferSliceStack;

            var buffer = bufferSliceStack.Pop();

            _bufferSize = buffer.Count;
            bufferSliceStack.Push(buffer);
        }
コード例 #8
0
 /// <summary>
 /// Add another handlers.
 /// </summary>
 /// <param name="mimeType">Mime type</param>
 /// <param name="decoder">The decoder implementation. Must be thread safe.</param>
 public void Add(string mimeType, IBodyDecoder decoder)
 {
     if (mimeType == null) throw new ArgumentNullException("mimeType");
     if (decoder == null) throw new ArgumentNullException("decoder");
     _decoders[mimeType] = decoder;
 }
コード例 #9
0
ファイル: Server.cs プロジェクト: RainsSoft/HttpWebServer
 /// <summary>
 /// Add a decoder.
 /// </summary>
 /// <param name="decoder">decoder to add</param>
 /// <remarks>
 /// Adding zero decoders will make the server add the
 /// default ones which is <see cref="MultiPartDecoder"/> and <see cref="UrlDecoder"/>.
 /// </remarks>
 public void Add(IBodyDecoder decoder)
 {
     _bodyDecoders.Add(decoder);
 }
コード例 #10
0
ファイル: Server.cs プロジェクト: rafavg77/MissVenom
 /// <summary>
 /// Add a decoder.
 /// </summary>
 /// <param name="decoder">decoder to add</param>
 /// <remarks>
 /// Adding zero decoders will make the server add the 
 /// default ones which is <see cref="MultiPartDecoder"/> and <see cref="UrlDecoder"/>.
 /// </remarks>
 public void Add(IBodyDecoder decoder)
 {
     _bodyDecoders.Add(decoder);
 }