Response message:Server response should contain 'Connection' header with value 'Upgrade'
Hi, I am facing the issue "Response message: Server response should contain 'Connection' header with value 'Upgrade'" when trying to open the web socket connection.
I have followed your socket.io-chatserversample.jmx, the initial HTTP Request was successful but WebSocket open connection fails - response body and response headers both are empty.
can you please help me to understand and fix this issue.
Comments (7)
-
repo owner -
I have found the issue in file WebSocketClient.java line number 500
if (! "upgrade".equals(getLowerCase(serverHeaders.get("Connection")))) // According to RFC 6455 section 4.1, client must match case-insensative throw new HttpUpgradeException("Server response should contain 'Connection' header with value 'Upgrade'");*/
in my case the key 'Connection' has value “Upgrade, Upgrade”
as we check for only “upgrade” it throws the exception
which is added from the if block
do { line = httpReader.readLine(); log.debug("<< " + line); if (line != null) { String[] values = line.split(":", 2); if (values.length > 1) { String key = values[0]; String value = values[1].trim(); if (serverHeaders.containsKey(key)) { log.debug("-- if SH" + key + "," + value); serverHeaders.put(key, serverHeaders.get(key) + ", " + value); } else { log.debug("-- else SH" + key + "," + value); serverHeaders.put(key, value); } } } } while (line != null && line.trim().length() > 0);
-
repo owner - changed title to Response message:Server response should contain 'Connection' header with value 'Upgrade'
-
repo owner Well, you’re right that the plugin does not handle multi-value header correctly, but a server sending a connection header with twice the same value sounds as a bug as well; at least it is quite silly.
-
Stalin and how did you fix this error?
-
@Ewelina Kalemba
Hi, I have changed the below line to check for “contains” instead of “equals”
WebSocketClient.java line number 500
from
if (! "upgrade".equals(getLowerCase(serverHeaders.get("Connection"))))
to
if(!(getLowerCase(serverHeaders.get("Connection")))
.contains(“upgrade”
))
-
thx:D
- Log in to comment