소스 검색

Try to handle zlib errors

shamoon 2 년 전
부모
커밋
abcea88d0a
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      src/utils/proxy/http.js

+ 7 - 0
src/utils/proxy/http.js

@@ -33,6 +33,13 @@ function handleRequest(requestor, url, params) {
       const contentEncoding = response.headers['content-encoding']?.trim().toLowerCase();
 
       let responseContent = response;
+
+      // zlib errors
+      responseContent.on("error", (e) => {
+        logger.error(e);
+        responseContent = response; // fallback
+      });
+
       if (contentEncoding === 'gzip' || contentEncoding === 'deflate') {
         responseContent = createUnzip();
         response.pipe(responseContent);