Example #1
0
        public DateTime?HeaderDateTime(string name)
        {
            StringValues vs;

            if (Request.Headers.TryGetValue(name, out vs))
            {
                string   str = vs;
                DateTime v;
                if (StrUtility.TryParseUtcDate(str, out v))
                {
                    return(v);
                }
            }
            return(null);
        }
Example #2
0
        /// <summary>
        /// To construct from memory byte array.
        /// </summary>
        public StaticContent(ArraySegment <byte> bytea)
        {
            this.buffer = bytea.Array;
            this.size   = bytea.Count;

            // calculate checksum
            ulong checksum = 0;

            for (int i = 0; i < size; i++)
            {
                byte  b  = buffer[0];
                ulong cs = checksum;
                cs      ^= b;                  // XOR
                checksum = cs >> 57 | cs << 7; // circular left shift 7 bit
            }
            etag = StrUtility.ToHex(checksum);
        }
Example #3
0
        public void SetHeader(string name, DateTime v)
        {
            string str = StrUtility.FormatUtcDate(v);

            Response.Headers.Add(name, new StringValues(str));
        }