提交 8493c88f authored 作者: Anthony Minessale's avatar Anthony Minessale

fix proto regression from last commit

上级 c1e19690
Thu Sep 19 13:44:16 CDT 2013 Thu Sep 19 19:34:50 EDT 2013
...@@ -223,6 +223,7 @@ int ws_handshake(wsh_t *wsh) ...@@ -223,6 +223,7 @@ int ws_handshake(wsh_t *wsh)
char key[256] = ""; char key[256] = "";
char version[5] = ""; char version[5] = "";
char proto[256] = ""; char proto[256] = "";
char proto_buf[384] = "";
char uri[256] = ""; char uri[256] = "";
char input[256] = ""; char input[256] = "";
unsigned char output[SHA1_HASH_SIZE] = ""; unsigned char output[SHA1_HASH_SIZE] = "";
...@@ -274,7 +275,7 @@ int ws_handshake(wsh_t *wsh) ...@@ -274,7 +275,7 @@ int ws_handshake(wsh_t *wsh)
b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64)); b64encode((unsigned char *)output, SHA1_HASH_SIZE, (unsigned char *)b64, sizeof(b64));
if (*proto) { if (*proto) {
snprintf(proto, sizeof(proto), "Sec-WebSocket-Protocol: %s\r\n", proto); snprintf(proto_buf, sizeof(proto_buf), "Sec-WebSocket-Protocol: %s\r\n", proto);
} }
snprintf(respond, sizeof(respond), snprintf(respond, sizeof(respond),
...@@ -284,7 +285,7 @@ int ws_handshake(wsh_t *wsh) ...@@ -284,7 +285,7 @@ int ws_handshake(wsh_t *wsh)
"Sec-WebSocket-Accept: %s\r\n" "Sec-WebSocket-Accept: %s\r\n"
"%s\r\n", "%s\r\n",
b64, b64,
proto); proto_buf);
ws_raw_write(wsh, respond, strlen(respond)); ws_raw_write(wsh, respond, strlen(respond));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论