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)
168
168
char * sec_ws_origin = NULL ;
169
169
char * sec_ws_key = NULL ;
170
170
char sec_ws_version = 0 ;
171
+ const char * proto_binary ;
172
+ const char * proto_base64 ;
171
173
ws_ctx_t * wsctx = NULL ;
172
174
173
175
buf = (char * ) malloc (WEBSOCKETS_MAX_HANDSHAKE_LEN );
@@ -289,13 +291,15 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
289
291
return FALSE;
290
292
}
291
293
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 ))) {
293
297
rfbLog (" - webSocketsHandshake: using base64 encoding\n" );
294
298
base64 = TRUE;
295
299
protocol = "base64" ;
296
300
} else {
297
301
rfbLog (" - webSocketsHandshake: using binary/raw encoding\n" );
298
- if ((protocol ) && (strstr ( protocol , "binary" ) )) {
302
+ if ((protocol ) && (proto_binary )) {
299
303
protocol = "binary" ;
300
304
} else {
301
305
protocol = "" ;
You can’t perform that action at this time.
0 commit comments