File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,8 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
168168 char * sec_ws_origin = NULL ;
169169 char * sec_ws_key = NULL ;
170170 char sec_ws_version = 0 ;
171+ const char * proto_binary ;
172+ const char * proto_base64 ;
171173 ws_ctx_t * wsctx = NULL ;
172174
173175 buf = (char * ) malloc (WEBSOCKETS_MAX_HANDSHAKE_LEN );
@@ -289,13 +291,15 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
289291 return FALSE;
290292 }
291293
292- if ((protocol ) && (strstr (protocol , "base64" ))) {
294+ proto_binary = strstr (protocol , "binary" );
295+ proto_base64 = strstr (protocol , "base64" );
296+ if ((protocol ) && (proto_base64 && (!proto_binary || proto_base64 < proto_binary ))) {
293297 rfbLog (" - webSocketsHandshake: using base64 encoding\n" );
294298 base64 = TRUE;
295299 protocol = "base64" ;
296300 } else {
297301 rfbLog (" - webSocketsHandshake: using binary/raw encoding\n" );
298- if ((protocol ) && (strstr ( protocol , "binary" ) )) {
302+ if ((protocol ) && (proto_binary )) {
299303 protocol = "binary" ;
300304 } else {
301305 protocol = "" ;
You can’t perform that action at this time.
0 commit comments