protected override string InternalGet(string name)
        {
            int    headerIndex = HttpWorkerRequest.GetKnownRequestHeaderIndex(name);
            string headerValue = null;

            if (headerIndex >= 0)
            {
                headerValue = _request.WorkerRequest.GetKnownRequestHeader(headerIndex);
            }
            if (headerValue == null)
            {
                headerValue = _request.WorkerRequest.GetUnknownRequestHeader(name);
            }
            return(headerValue);
        }
示例#2
0
 private void SynchronizeHeader(string name, string value)
 {
     if (StringUtil.StringStartsWith(name, "HTTP_"))
     {
         string header = name.Substring("HTTP_".Length).Replace('_', '-');
         int    knownRequestHeaderIndex = HttpWorkerRequest.GetKnownRequestHeaderIndex(header);
         if (knownRequestHeaderIndex > -1)
         {
             header = HttpWorkerRequest.GetKnownRequestHeaderName(knownRequestHeaderIndex);
         }
         HttpHeaderCollection headers = this._request.Headers as HttpHeaderCollection;
         if (headers != null)
         {
             headers.SynchronizeHeader(header, value);
         }
     }
 }
        private void SynchronizeHeader(String name, String value)
        {
            if (StringUtil.StringStartsWith(name, "HTTP_"))
            {
                // update managed copy of header
                string headerName = name.Substring("HTTP_".Length);
                headerName = headerName.Replace('_', '-');
                int knownIndex = HttpWorkerRequest.GetKnownRequestHeaderIndex(headerName);
                if (knownIndex > -1)
                {
                    headerName = HttpWorkerRequest.GetKnownRequestHeaderName(knownIndex);
                }

                HttpHeaderCollection headers = _request.Headers as HttpHeaderCollection;
                if (headers != null)
                {
                    headers.SynchronizeHeader(headerName, value);
                }
            }
        }