internal void AddHeader(string header)
        {
            var colon = header.IndexOf(':');

            if (colon == -1)
            {
                _context.ErrorMessage = "Invalid header";
                return;
            }

            var name = header.Substring(0, colon).Trim();
            var val  = header.Substring(colon + 1).Trim();

            _headers.InternalSet(name, val, false);

            var lower = name.ToLower(CultureInfo.InvariantCulture);

            if (lower == "accept")
            {
                _acceptTypes = new List <string> (val.SplitHeaderValue(',')).ToArray();
                return;
            }

            if (lower == "accept-language")
            {
                _userLanguages = val.Split(',');
                return;
            }

            if (lower == "content-length")
            {
                long len;
#if SSHARP
                if (Int64Ex.TryParse(val, out len) && len >= 0)
#else
                if (Int64.TryParse(val, out len) && len >= 0)
#endif
                {
                    _contentLength    = len;
                    _contentLengthSet = true;
                }
                else
                {
                    _context.ErrorMessage = "Invalid Content-Length header";
                }

                return;
            }

            if (lower == "content-type")
            {
                try
                {
                    _contentType     = HttpUtility.GetMimeType(val);
                    _contentEncoding = HttpUtility.GetEncoding(val);
                }
                catch
                {
                    _context.ErrorMessage = "Invalid Content-Type header";
                }

                return;
            }

            if (lower == "referer")
            {
                _referer = val.ToUri();
            }
        }