private long ContentLength() { if (_contentLength == long.MinValue) { _contentLength = HttpUtil.GetContentLength(_message, -1L); } return(_contentLength); }
long ContentLength() { if (this.contentLength == long.MinValue) { this.contentLength = HttpUtil.GetContentLength(this.message, -1L); } return(this.contentLength); }
protected override bool IsContentLengthInvalid(IHttpMessage start, int maxContentLength) { try { return(HttpUtil.GetContentLength(start, -1) > maxContentLength); } catch (FormatException) { return(false); } }
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); }