File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ private void SendRequest(Stream target)
184184 [ return : NotNullIfNotNull ( "response" ) ]
185185 private DefaultResponse ? GetResponse ( HttpWebResponse ? response )
186186 {
187- if ( response != null )
187+ if ( response is not null )
188188 {
189189 var originalCookies = _cookies . GetCookies ( _request . Address ! ) ;
190190 var newCookies = _cookies . GetCookies ( response . ResponseUri ) ;
@@ -200,6 +200,19 @@ private void SendRequest(Stream target)
200200 foreach ( var header in headers )
201201 {
202202 result . Headers . Add ( header . Key , header . Value ) ;
203+
204+ if ( header . Key . Isi ( HeaderNames . ContentEncoding ) )
205+ {
206+ switch ( header . Value )
207+ {
208+ case "" :
209+ case "gzip" :
210+ case "deflate" :
211+ break ;
212+ default :
213+ throw new InvalidOperationException ( $ "The given server response is invalid. The encoding '{ header . Value } ' is not supported.") ;
214+ }
215+ }
203216 }
204217
205218 if ( cookies . Length > 0 )
You can’t perform that action at this time.
0 commit comments