Ejemplo n.º 1
0
 private long ContentLength()
 {
     if (_contentLength == long.MinValue)
     {
         _contentLength = HttpUtil.GetContentLength(_message, -1L);
     }
     return(_contentLength);
 }
Ejemplo n.º 2
0
 long ContentLength()
 {
     if (this.contentLength == long.MinValue)
     {
         this.contentLength = HttpUtil.GetContentLength(this.message, -1L);
     }
     return(this.contentLength);
 }
Ejemplo n.º 3
0
 protected override bool IsContentLengthInvalid(IHttpMessage start, int maxContentLength)
 {
     try
     {
         return(HttpUtil.GetContentLength(start, -1) > maxContentLength);
     }
     catch (FormatException)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        static object ContinueResponse(IHttpMessage start, int maxContentLength, IChannelPipeline pipeline)
        {
            if (HttpUtil.IsUnsupportedExpectation(start))
            {
                // if the request contains an unsupported expectation, we return 417
                pipeline.FireUserEventTriggered(HttpExpectationFailedEvent.Default);
                return(ExpectationFailed.RetainedDuplicate());
            }
            else if (HttpUtil.Is100ContinueExpected(start))
            {
                // if the request contains 100-continue but the content-length is too large, we return 413
                if (HttpUtil.GetContentLength(start, -1L) <= maxContentLength)
                {
                    return(Continue.RetainedDuplicate());
                }
                pipeline.FireUserEventTriggered(HttpExpectationFailedEvent.Default);
                return(TooLarge.RetainedDuplicate());
            }

            return(null);
        }