Add formatting for SockJS GoAway frame
Prevents infinite loop for xhr-polling and xhr-streaming transports. See gh-28000
This commit is contained in:
committed by
rstoyanchev
parent
88f73bffa0
commit
f004bb1b64
@@ -79,9 +79,11 @@ public abstract class AbstractHttpSendingTransportHandler extends AbstractTransp
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Connection already closed (but not removed yet) for " + sockJsSession);
|
||||
}
|
||||
SockJsFrameFormat frameFormat = this.getFrameFormat(request);
|
||||
SockJsFrame frame = SockJsFrame.closeFrameGoAway();
|
||||
String formattedFrame = frameFormat.format(frame);
|
||||
try {
|
||||
response.getBody().write(frame.getContentBytes());
|
||||
response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET));
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new SockJsException("Failed to send " + frame, sockJsSession.getId(), ex);
|
||||
|
||||
@@ -257,7 +257,8 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
|
||||
synchronized (this.responseLock) {
|
||||
try {
|
||||
if (isClosed()) {
|
||||
response.getBody().write(SockJsFrame.closeFrameGoAway().getContentBytes());
|
||||
String formattedFrame = frameFormat.format(SockJsFrame.closeFrameGoAway());
|
||||
response.getBody().write(formattedFrame.getBytes(SockJsFrame.CHARSET));
|
||||
return;
|
||||
}
|
||||
this.response = response;
|
||||
|
||||
Reference in New Issue
Block a user