瀏覽代碼

Autoformat source code

bel 10 年之前
父節點
當前提交
e5cd69ef3c
共有 1 個文件被更改,包括 4 次插入12 次删除
  1. 4 12
      src/civetweb.c

+ 4 - 12
src/civetweb.c

@@ -7280,24 +7280,16 @@ static int send_websocket_handshake(struct mg_connection *conn)
 	SHA1Final((unsigned char *)sha, &sha_ctx);
 	base64_encode((unsigned char *)sha, sizeof(sha), b64_sha);
 	mg_printf(conn,
-	          "%s%s%s",
 	          "HTTP/1.1 101 Switching Protocols\r\n"
 	          "Upgrade: websocket\r\n"
 	          "Connection: Upgrade\r\n"
-	          "Sec-WebSocket-Accept: ",
-	          b64_sha,
-	          "\r\n");
+	          "Sec-WebSocket-Accept: %s\r\n",
+	          b64_sha);
 	protocol = mg_get_header(conn, "Sec-WebSocket-Protocol");
 	if (protocol) {
-	mg_printf(conn,
-		"%s%s%s",
-		"Sec-WebSocket-Protocol:",
-		protocol,
-		"\r\n\r\n");
+		mg_printf(conn, "Sec-WebSocket-Protocol: %s\r\n\r\n", protocol);
 	} else {
-		mg_printf(conn,
-			"%s",
-			"\r\n");
+		mg_printf(conn, "%s", "\r\n");
 	}
 
 	return 1;