File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 22using System . Collections . Generic ;
33using System . IO ;
44using System . IO . Compression ;
5+ using System . Linq ;
56using System . Text ;
67using System . Text . RegularExpressions ;
78using System . Threading ;
@@ -976,16 +977,20 @@ private void ParseCookieFromHeader(string headerValue)
976977
977978 #region Загрузка тела сообщения
978979
979- private IEnumerable < BytesWrapper > GetMessageBodySource ( )
980+ // ReSharper disable once ReturnTypeCanBeEnumerable.Local
981+ private BytesWrapper [ ] GetMessageBodySource ( )
980982 {
981- if ( _headers . ContainsKey ( "Content-Encoding" ) &&
982- ! string . Equals ( _headers [ "Content-Encoding" ] ,
983- "utf-8" , StringComparison . OrdinalIgnoreCase ) ) // Yandex oauth
984- {
985- return GetMessageBodySourceZip ( ) ;
986- }
987-
988- return GetMessageBodySourceStd ( ) ;
983+ bool isNonUtf8ContentEncoding =
984+ _headers . ContainsKey ( "Content-Encoding" ) &&
985+ // Yandex oauth fix
986+ ! string . Equals ( _headers [ "Content-Encoding" ] , "utf-8" , StringComparison . OrdinalIgnoreCase ) ;
987+
988+ var result = isNonUtf8ContentEncoding
989+ ? GetMessageBodySourceZip ( )
990+ : GetMessageBodySourceStd ( ) ;
991+
992+ // It's a fix of response get stuck response issue #83: https://github.com/csharp-leaf/Leaf.xNet/issues/83
993+ return result . ToArray ( ) ;
989994 }
990995
991996 // Загрузка обычных данных.
You can’t perform that action at this time.
0 commit comments