ITADN

Readable stream from chunked transfer encoding seems to miss some chunks

#20Openbmatthieu3 创建于 2023-04-26
B
bmatthieu3commented
Hi @MattiasBuelens , We are passing by a proxy to get files that are coming from a server which does not have CORS headers. Requesting the file from our proxy have this headers: ``` > GET /cgi/JSONProxy?url=https%3A%2F%2Fcdsarc.cds.unistra.fr%2Fsaadavizier%2Fdownload%3Foid%3D864974746620526595 HTTP/1.1 > Host: alasky.cds.unistra.fr > Accept-Encoding: deflate, gzip > Accept: */* > Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7 > Connection: keep-alive > DNT: 1 > Origin: http://localhost:8080 > Referer: http://localhost:8080/ > Sec-Fetch-Dest: empty > Sec-Fetch-Mode: cors > Sec-Fetch-Site: cross-site > User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 > sec-ch-ua: "Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99" > sec-ch-ua-mobile: ?0 > sec-ch-ua-platform: "macOS" > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Date: Wed, 26 Apr 2023 09:09:50 GMT < Server: Apache/2.4.25 (Debian) < Vary: Accept-Encoding < Content-Encoding: gzip < Access-Control-Allow-Headers: * < Access-Control-Allow-Methods: GET, OPTIONS < Access-Control-Allow-Origin: * < Keep-Alive: timeout=5, max=100 < Connection: Keep-Alive < Transfer-Encoding: chunked < Content-Type: application/fits ``` I see that the transfer-encoding is "chunked", maybe it is the reason why I am seeing that: <img width="738" alt="image" src="https://user-images.githubusercontent.com/2772384/234530523-9f1833aa-23c0-43bb-86d4-0abcaa0cd663.png"> If I download the file manually and then drag and drop/open it in my application I get the correct image: <img width="737" alt="image" src="https://user-images.githubusercontent.com/2772384/234530963-3712d819-a162-41cb-bb07-c95c12399a6f.png"> It is like some chunks are missing but other are correctly received and parsed. The code used behind one or the other method is similar: * I fetch the url, in the first case, it is the one using the proxy, on the other, it is an url computed from the local File object opened * Then the code is similar, I get the ReadableStream from the response body and convert it using wasm-streams to an async reader. Thank you very much, maybe you have an idea on what may cause this issue.
4 条评论