Websocket requests receiving 400 Bad Request based on size

Discuss any topic about Brekeke SIP Server.

Moderator: Brekeke Support Team

Post Reply
pgrebenc
Posts: 4
Joined: Mon Aug 10, 2015 1:50 pm

Websocket requests receiving 400 Bad Request based on size

Post by pgrebenc »

1. Brekeke Product Name and Version: 3.5.3.0

2. Java version: 1.8.0_66

3. OS type and the version: CentOS 6

4. UA (phone), gateway or other hardware/software involved: JsSIP 0.7.23

5. Your problem:

I have noticed that occasionally a 400 Bad Request response is received when a websocket connection is attempted to the Brekeke SIP server. I have tracked this down to the size of either the total request, or the size of the cookie header in the request.

We are currently hosting web applications on the same host with the SIP server websocket endpoint. Therefore, any cookies applicable to the host are also included in the websocket requests sent to the SIP server.

Through testing, I was able to cause a request to fail, and I have copied an example below (modified only to blank out the host fields), along with the response from the Brekeke server. If this same request is sent with the cookie value one character less, the websocket connection is successful.

Our cookie header length is well within the minimum recommended limits specified in RFC 6265. Is there anything that we can do to allow these requests to be supported?


GET https://xxx.xxxxxxxxxxx.xxxxxxxx.xxx:10081/ HTTP/1.1
Host: xxx.xxxxxxxxxxx.xxxxxxxx.xxx:10081
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: https://xxx.xxxxxxxxxxx.xxxxxxxx.xxx
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Cookie: foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sec-WebSocket-Key: eZi8jjUjs/i2ATV8/i0aow==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Protocol: sip



HTTP/1.1 400 Bad Request
Server: Brekeke SIP Server rev.424
Date: Tue, 09 May 2017 15:47:26 GMT
Content-Type: text/html
Content-Length: 155

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>400 Bad Request</h1>
</body></html>
lakeview
Posts: 319
Joined: Thu Nov 15, 2007 11:54 am
Location: Florida

Post by lakeview »

HTTP request's packet buffer size for WebSocket is 700 byte.

So resize the Cookie data to meet this limitation.
Post Reply