Ejemplo n.º 1
0
        private bool GetHeaderValue()
        {
            // remove white spaces.
            _reader.ConsumeWhiteSpaces();

            string value = _reader.ReadFoldedLine();

            if (value == null)
            {
                throw new ParseException(ExceptionMessage.InvalidFormat);
            }

            _headerValue += value;

            _headerValue = ProcessSingleLine(_headerValue);

            if (System.String.Compare(_headerName, SipHeaderNames.ContentLength, System.StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (!int.TryParse(value, out _bodyBytesLeft))
                {
                    throw new ParseException("Content length is not a number.");
                }
            }

            _onHeader(_headerName, _headerValue);

            _headerName   = null;
            _headerValue  = string.Empty;
            _parserMethod = GetHeaderName;
            return(true);
        }