@@ -52,7 +52,7 @@ public Encoding ContentEncoding
5252 if ( _contentEncoding != null )
5353 return _contentEncoding ;
5454
55- var contentType = Headers [ "Content-Type" ] ;
55+ var contentType = Headers [ HttpHeaderNames . ContentType ] ;
5656
5757 if ( ! string . IsNullOrEmpty ( contentType ) )
5858 {
@@ -63,7 +63,7 @@ public Encoding ContentEncoding
6363 }
6464
6565 var defaultEncoding = Encoding . UTF8 ;
66- var acceptCharset = Headers [ "Accept-Charset" ] ? . SplitByComma ( )
66+ var acceptCharset = Headers [ HttpHeaderNames . AcceptCharset ] ? . SplitByComma ( )
6767 . Select ( x => x . Trim ( ) . Split ( ';' ) )
6868 . Select ( x => new
6969 {
@@ -129,7 +129,7 @@ public bool KeepAlive
129129 // 1. Connection header
130130 // 2. Protocol (1.1 == keep-alive by default)
131131 // 3. Keep-Alive header
132- var cnc = Headers [ " Connection" ] ;
132+ var cnc = Headers [ HttpHeaderNames . Connection ] ;
133133 if ( ! string . IsNullOrEmpty ( cnc ) )
134134 {
135135 _keepAlive = string . Compare ( cnc , "keep-alive" , StringComparison . OrdinalIgnoreCase ) == 0 ;
@@ -140,7 +140,7 @@ public bool KeepAlive
140140 }
141141 else
142142 {
143- cnc = Headers [ "keep-alive" ] ;
143+ cnc = Headers [ HttpHeaderNames . KeepAlive ] ;
144144
145145 if ( ! string . IsNullOrEmpty ( cnc ) )
146146 _keepAlive = string . Compare ( cnc , "closed" , StringComparison . OrdinalIgnoreCase ) != 0 ;
@@ -172,20 +172,20 @@ public bool KeepAlive
172172 public Uri UrlReferrer { get ; private set ; }
173173
174174 /// <inheritdoc />
175- public string UserAgent => Headers [ "user-agent" ] ;
175+ public string UserAgent => Headers [ HttpHeaderNames . UserAgent ] ;
176176
177177 public string UserHostAddress => LocalEndPoint . ToString ( ) ;
178178
179- public string UserHostName => Headers [ "host" ] ;
179+ public string UserHostName => Headers [ HttpHeaderNames . Host ] ;
180180
181181 public string [ ] UserLanguages { get ; private set ; }
182182
183183 /// <inheritdoc />
184184 public bool IsWebSocketRequest
185185 => HttpVerb == HttpVerbs . Get
186186 && ProtocolVersion >= HttpVersion . Version11
187- && Headers . Contains ( " Upgrade" , "websocket" )
188- && Headers . Contains ( " Connection" , "Upgrade" ) ;
187+ && Headers . Contains ( HttpHeaderNames . Upgrade , "websocket" )
188+ && Headers . Contains ( HttpHeaderNames . Connection , "Upgrade" ) ;
189189
190190 /// <summary>
191191 /// Begins to the get client certificate asynchronously.
@@ -477,6 +477,7 @@ private void CreateQueryString(string query)
477477 query = query . Substring ( 1 ) ;
478478
479479 var components = query . Split ( '&' ) ;
480+
480481 foreach ( var kv in components )
481482 {
482483 var pos = kv . IndexOf ( '=' ) ;
0 commit comments