From 411d4dc1b3e29cde59d118e5bda9fb7ef9fdfbe5 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 28 Mar 2021 03:38:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dws=E8=BF=9E=E6=8E=A5=E5=90=8E?= =?UTF-8?q?=E8=A2=AB=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=96=AD=E5=BC=80=E6=97=B6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/websocket.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index 088e650f..8ac28640 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -131,14 +131,11 @@ while true do--Running readCHN:push(op) if op==8 then--close SOCK:close() - if res:sub(1,4)=="HTTP"then - local code=res:find(" ") - code=res:sub(code+1,code+3) - local res=res:sub(res:find("\n\n")+1) - reason=JSON.decode(res)if reason then reason=reason.message end - readCHN:push(code.."-"..(reason or res)) + if type(res)=="string"then + local reason=JSON.decode(res) + readCHN:push(reason and reason.message or"Server Error") else - readCHN:push(string.format("%d-%s",shl(byte(res,1),8)+byte(res,2),res:sub(3,-3))) + readCHN:push("Server Error") end else readCHN:push(res)