tiger154 / jwebsocket

Automatically exported from code.google.com/p/jwebsocket
1 stars 0 forks source link

BaseWebSocketClient fails to parse the cookie #184

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. JWC.init()
2. JWC.open()
3. JWC.broadcastText("test")

What is the expected output? What do you see instead?
expected: "connected"
see: "org.jwebsocket.kit.WebSocketException: Error while sending binary data: 
not connected"

What version of the product are you using? On what operating system?
Debian 64bit with jWebSocket beta 8
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Please provide any additional information below.
exception occurs because HttpCookie.parse(lSetCookie); in line 280 of 
BaseWebSocketClient throws an IllegalArgumentException (Illegal cookie 
attribute). The cookie looks like this: 
"JWSSESSIONID=7fcb6127a395a3044997b1e184b9b7ec; HttpOnly". 

According to RFC 2965 section 3.2.2:
cookie          =       NAME "=" VALUE *(";" set-cookie-av)

which would mean that we are missing =something after HttpOnly.

Original issue reported on code.google.com by mail...@googlemail.com on 3 Jul 2012 at 8:41

GoogleCodeExporter commented 9 years ago
I think this is actually a JRE problem rather than JWS. Switching from 1.6 to 
1.7 (Debian sid x86_64) fixes the problem for me:

# apt-get install openjdk-7-jre
# update-alternatives --config java

(and optionally switch to jdk/javac 1.7 too)

RFC 2965 was made obsolete by RFC 6265 [1] and according to section 4.1.1, the 
JWS cookie itself looks OK.

I haven't looked any further into the problem with 1.6, but I hope that's some 
help.

[1] http://tools.ietf.org/html/rfc6265

Original comment by jamiefo...@gmail.com on 30 Jul 2012 at 7:32

GoogleCodeExporter commented 9 years ago
Yep, that solved it. Thank you!

Original comment by mail...@googlemail.com on 7 Aug 2012 at 6:02