Commit 70dab39b authored by Johannes Schindelin's avatar Johannes Schindelin
parent 02651bac
...@@ -479,6 +479,7 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout) ...@@ -479,6 +479,7 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
#endif #endif
if (n > 0) { if (n > 0) {
fwrite(buf, n, 1, stderr);
buf += n; buf += n;
len -= n; len -= n;
......
...@@ -143,6 +143,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme) ...@@ -143,6 +143,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
if ((n = rfbReadExactTimeout(cl, buf+len, 1, if ((n = rfbReadExactTimeout(cl, buf+len, 1,
WEBSOCKETS_CLIENT_SEND_WAIT_MS)) <= 0) { WEBSOCKETS_CLIENT_SEND_WAIT_MS)) <= 0) {
if ((n < 0) && (errno == ETIMEDOUT)) { if ((n < 0) && (errno == ETIMEDOUT)) {
rfbLog("webSocketsHandshake: timed out\n");
break; break;
} }
if (n == 0) if (n == 0)
...@@ -160,6 +161,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme) ...@@ -160,6 +161,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
if (key1 && key2) { if (key1 && key2) {
if ((n = rfbReadExact(cl, buf+len, 8)) <= 0) { if ((n = rfbReadExact(cl, buf+len, 8)) <= 0) {
if ((n < 0) && (errno == ETIMEDOUT)) { if ((n < 0) && (errno == ETIMEDOUT)) {
rfbLog("webSocketsHandshake: timed out\n");
break; break;
} }
if (n == 0) if (n == 0)
...@@ -190,6 +192,10 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme) ...@@ -190,6 +192,10 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
origin = line+8; origin = line+8;
buf[len-2] = '\0'; buf[len-2] = '\0';
/* rfbLog("Got origin: %s\n", origin); */ /* rfbLog("Got origin: %s\n", origin); */
} else if ((strncasecmp("sec-websocket-origin: ", line, min(llen,22))) == 0) {
origin = line+22;
buf[len-2] = '\0';
/* rfbLog("Got origin: %s\n", origin); */
} else if ((strncasecmp("sec-websocket-key1: ", line, min(llen,20))) == 0) { } else if ((strncasecmp("sec-websocket-key1: ", line, min(llen,20))) == 0) {
key1 = line+20; key1 = line+20;
buf[len-2] = '\0'; buf[len-2] = '\0';
...@@ -208,7 +214,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme) ...@@ -208,7 +214,7 @@ webSocketsHandshake(rfbClientPtr cl, char *scheme)
} }
if (!(path && host && origin)) { if (!(path && host && origin)) {
rfbErr("webSocketsHandshake: incomplete client handshake\n"); rfbErr("webSocketsHandshake: incomplete client handshake (%s, %s, %s)\n", path ? path : "(null)", host ? host : "(null)", origin ? origin : "(null)");
free(response); free(response);
free(buf); free(buf);
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment