Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f1d0357e
提交
f1d0357e
authored
9月 18, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor fixes in ws.c
上级
1d992ea9
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
20 行增加
和
6 行删除
+20
-6
.update
libs/sofia-sip/.update
+1
-1
ws.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
+19
-5
没有找到文件。
libs/sofia-sip/.update
浏览文件 @
f1d0357e
Tue Sep 17 06:24:17
CDT 2013
Wed Sep 18 05:12:10
CDT 2013
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
浏览文件 @
f1d0357e
...
...
@@ -242,7 +242,7 @@ int ws_handshake(wsh_t *wsh)
}
}
if
(
bytes
>
sizeof
(
wsh
->
buffer
))
{
if
(
bytes
>
sizeof
(
wsh
->
buffer
)
-
1
)
{
goto
err
;
}
...
...
@@ -273,12 +273,16 @@ int ws_handshake(wsh_t *wsh)
sha1_digest
(
output
,
input
);
b64encode
((
unsigned
char
*
)
output
,
SHA1_HASH_SIZE
,
(
unsigned
char
*
)
b64
,
sizeof
(
b64
));
if
(
*
proto
)
{
snprintf
(
proto
,
sizeof
(
proto
),
"Sec-WebSocket-Protocol: %s
\r\n
"
,
proto
);
}
snprintf
(
respond
,
sizeof
(
respond
),
"HTTP/1.1 101 Switching Protocols
\r\n
"
"Upgrade: websocket
\r\n
"
"Connection: Upgrade
\r\n
"
"Sec-WebSocket-Accept: %s
\r\n
"
"
Sec-WebSocket-Protocol: %s
\r\n
\r\n
"
,
"
%s
\r\n
"
,
b64
,
proto
);
...
...
@@ -319,7 +323,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
#endif
}
while
(
r
==
-
1
&&
SSL_get_error
(
wsh
->
ssl
,
r
)
==
SSL_ERROR_WANT_READ
&&
x
<
100
);
return
r
;
goto
end
;
}
do
{
...
...
@@ -336,6 +340,12 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes)
r
=
-
1
;
}
end:
if
(
r
>
0
)
{
*
((
char
*
)
data
+
r
)
=
'\0'
;
}
return
r
;
}
...
...
@@ -530,7 +540,7 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason)
restore_socket
(
wsh
->
sock
);
if
(
wsh
->
close_sock
)
{
if
(
wsh
->
close_sock
&&
wsh
->
sock
!=
ws_sock_invalid
)
{
close
(
wsh
->
sock
);
}
...
...
@@ -559,7 +569,11 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
return
ws_close
(
wsh
,
WS_PROTO_ERR
);
}
if
((
wsh
->
datalen
=
ws_raw_read
(
wsh
,
wsh
->
buffer
,
9
))
<
need
)
{
if
((
wsh
->
datalen
=
ws_raw_read
(
wsh
,
wsh
->
buffer
,
9
))
<
0
)
{
return
ws_close
(
wsh
,
WS_PROTO_ERR
);
}
if
(
wsh
->
datalen
<
need
)
{
if
((
wsh
->
datalen
+=
ws_raw_read
(
wsh
,
wsh
->
buffer
+
wsh
->
datalen
,
9
-
wsh
->
datalen
))
<
need
)
{
/* too small - protocol err */
return
ws_close
(
wsh
,
WS_PROTO_ERR
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论