DO not trust via header when forwarding WS messages

This commit is contained in:
bossiel 2012-12-03 06:28:13 +00:00
parent cb112782f0
commit 7d2e8e8142
2 changed files with 3 additions and 5 deletions

View File

@ -129,12 +129,12 @@ int tsip_transport_addvia(const tsip_transport_t* self, const char *branch, tsip
tsip_transport_stream_peer_t* peer = tsip_transport_find_stream_peer_by_local_fd(TSIP_TRANSPORT(ws_transport), msg->local_fd);
if(peer){
// hack the first Via as many servers fail to parse "WS" or "WSS" as valid transpors
if(tsk_striequals(msg->firstVia->transport, "WS") || tsk_striequals(msg->firstVia->transport, "WSS")){
TSIP_HEADER_ADD_PARAM(TSIP_HEADER(msg->firstVia), "ws-hacked", msg->firstVia->transport);
//if(tsk_striequals(msg->firstVia->transport, "WS") || tsk_striequals(msg->firstVia->transport, "WSS")){
TSIP_HEADER_ADD_PARAM(TSIP_HEADER(msg->firstVia), "ws-hacked", TNET_SOCKET_TYPE_IS_WSS(msg->src_net_type) ? "WSS" : "WS");
tsk_strupdate(&msg->firstVia->transport, "TCP");
tsk_strupdate(&msg->firstVia->host, peer->remote_ip);
msg->firstVia->port = peer->remote_port;
}
//}
TSK_OBJECT_SAFE_FREE(peer);
// replace first Via with ours

View File

@ -501,8 +501,6 @@ parse_buffer:
goto bail;
}
TSK_DEBUG_INFO("%s", (const char*)peer->ws_rcv_buffer);
// If we are there this mean that we have all SIP headers.
// ==> Parse the SIP message without the content.
tsk_ragel_state_init(&state, peer->ws_rcv_buffer, (tsk_size_t)pay_len);