I have an issue with connecting to a spring websocket implementation.
After debugging the code, I find that the request header 'Connection' has two values, 'keep-alive' and 'Upgrade' from my simple javascript code.
The fiddler output of the request is :-
GET http://localhost:8282/play/stream HTTP/1.1
Host: localhost:8282
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Authorization: Basic bXNhZG1pbjptc2FkbWlu
Upgrade: websocket
Connection: Upgrade
Origin: http://localhost:8282
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Windows NT 5.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: JSESSIONID=8C8748DD08104EAD51296E4A9E846604
Sec-WebSocket-Key: 9edBIn/q4i5pyQOFf72SMA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
...The DefaultHandshakeHandler calls HttpHeaders.getConnection() which returns the FIRST value being 'keep-alive'. This, it compares to 'Upgrade' and 'upgrade' and fails.
What is the problem here? Is the keep-alive header allowed in this situation, and if so, is the logic incorrect?
I am using spring-websockets/spring-web 4.0.8.RELEASE
Cheers
The request is technically correct as HTTP 1.1 accepts multiple fields with the same field-name (RFC2616 section 4.2). However, HttpHeaders will only take the first value, that's the reason. Remove the first Connection header or reorder them so Connection: Upgrade is picked.