--- parser3/src/main/pa_websocket.C 2026/10/16 13:55:16 1.1 +++ parser3/src/main/pa_websocket.C 2026/10/17 23:11:25 1.4 @@ -10,7 +10,7 @@ #include "pa_sha1.h" #include "../lib/pcre/pa_pcre_internal.h" -volatile const char * IDENT_PA_WEBSOCKET_C="$Id: pa_websocket.C,v 1.1 2026/10/16 13:55:16 moko Exp $" IDENT_PA_WEBSOCKET_H; +volatile const char * IDENT_PA_WEBSOCKET_C="$Id: pa_websocket.C,v 1.4 2026/10/17 23:11:25 moko Exp $" IDENT_PA_WEBSOCKET_H; #define MAX_CONTROL_PAYLOAD 125 #define MIN_READ_SIZE 4096 @@ -123,11 +123,9 @@ void WebSocket::start(size_t amax_messag } bool WebSocket::fill(int timeout_ms) { - int ready; - while((ready=pa_sock_ready(connection.sock, false, timeout_ms))<0) { + int ready=pa_sock_ready(connection.sock, false, timeout_ms); + if(ready<0) { int no=pa_socks_errno(); - if(no==EINTR) - continue; throw Exception("httpd.read", 0, "error waiting for data: %s (%d)", pa_socks_strerr(no), no); } if(!ready) @@ -158,9 +156,9 @@ WebSocket::Parsed WebSocket::parse(Frame if(available<2) return INCOMPLETE; - bool fin=p[0] & 0x80; + bool fin=(p[0] & 0x80)!=0; int opcode=p[0] & 0x0F; - bool masked=p[1] & 0x80; + bool masked=(p[1] & 0x80)!=0; uint64_t length=p[1] & 0x7F; size_t header=2; @@ -322,7 +320,7 @@ void WebSocket::write_frame(int opcode, unsigned char header[10]; size_t header_size=0; - header[header_size++]=0x80 | opcode; + header[header_size++]=(unsigned char)(0x80 | opcode); if(size<126){ header[header_size++]=(unsigned char)size; } else if(size<=0xFFFF){