BonCodeAJP13.ServerPackets.BonCodeAJP13ForwardRequest.GetCorrectHeaderName C# (CSharp) Method

GetCorrectHeaderName() private method

Return a correct case for the HTTP header. IIS upper cases all header names this may throw of some Java programs. We redo the character case for all headers that were initially sent in by browser or client in to their orignal case. If this is an IIS generated header we will lower case the name and return it with escaped underscores.
private GetCorrectHeaderName ( String headerKey ) : string
headerKey String
return string
        private string GetCorrectHeaderName(String headerKey)
        {
            string retVal = headerKey.ToLower();

            if (retVal.StartsWith("http_")) retVal = retVal.Remove(0, 5); //IIS adds the HTTP_ prefix we need to remove
            retVal = retVal.Replace("_", "-"); //escape underscores to dashes
            if (this.p_RawHeadersTranlator.ContainsKey(retVal))
            {
                //inbound data had this header, use that spelling and casing
                retVal = (string)this.p_RawHeadersTranlator[retVal];
            };

            return retVal;
        }