File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,10 +151,16 @@ private async void MakeBinaryBytesRequest(WebBinaryData webData)
151151 {
152152 using ( Stream responseStream = response . GetResponseStream ( ) )
153153 {
154- m_MemoryStream . SetLength ( response . ContentLength ) ;
154+ var transferEncoding = response . Headers . Get ( "Transfer-Encoding" ) ;
155+ if ( string . IsNullOrWhiteSpace ( transferEncoding ) )
156+ {
157+ m_MemoryStream . SetLength ( response . ContentLength ) ;
158+ }
159+
155160 m_MemoryStream . Position = 0 ;
156161 await responseStream . CopyToAsync ( m_MemoryStream ) ;
157- webData . Task . SetResult ( new WebBufferResult ( webData . UserData , m_MemoryStream . ToArray ( ) ) ) ; // 将流的内容复制到内存流中并转换为byte数组
162+ var resultData = m_MemoryStream . ToArray ( ) ;
163+ webData . Task . SetResult ( new WebBufferResult ( webData . UserData , resultData ) ) ; // 将流的内容复制到内存流中并转换为byte数组
158164 }
159165 }
160166 }
You can’t perform that action at this time.
0 commit comments