Commit 01d0b5a7 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Idempotence was destroyed with the last fix, breaking HTTPS as it currently...

Idempotence was destroyed with the last fix, breaking HTTPS as it currently doesn't support NIO, it has now been restored. JM-959

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7039 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1df9578c
......@@ -173,7 +173,16 @@ public class HttpBindServlet extends HttpServlet {
.setContinuation(ContinuationSupport.getContinuation(request, connection));
request.setAttribute("request-session", connection.getSession());
request.setAttribute("request", connection.getRequestId());
respond(response, connection);
try {
respond(response, session.getResponse(connection.getRequestId())
.getBytes("utf-8"));
}
catch (HttpBindException e) {
response.sendError(e.getHttpError(), e.getMessage());
if (e.shouldCloseSession()) {
session.close();
}
}
}
}
}
......
......@@ -324,12 +324,17 @@ public class HttpSession extends ClientSession {
if(requestID > lastRequestID + 1) {
throw new HttpBindException("Invalid RID error.", true, 404);
}
connectionQueue.remove(connection);
fireConnectionClosed(connection);
if(requestID > lastRequestID) {
lastRequestID = connection.getRequestId();
}
return getResponse(connection);
String response = getResponse(connection);
// connection needs to be removed after response is returned to maintain idempotence
// otherwise if this method is called again, after 'waiting', the InternalError
// will be thrown because the connection is no longer in the queue.
connectionQueue.remove(connection);
fireConnectionClosed(connection);
return response;
}
}
throw new InternalError("Could not locate connection: " + requestID);
......@@ -424,7 +429,6 @@ public class HttpSession extends ClientSession {
== lastRequestID + 1)) {
String deliverable = createDeliverable(pendingElements);
try {
fireConnectionOpened(connection);
deliver(connection, deliverable);
lastRequestID = connection.getRequestId();
pendingElements.clear();
......@@ -444,11 +448,11 @@ public class HttpSession extends ClientSession {
HttpConnection toClose = connectionQueue.get(i);
toClose.close();
}
}
connectionQueue.add(connection);
Collections.sort(connectionQueue, connectionComparator);
fireConnectionOpened(connection);
}
}
private void deliver(HttpConnection connection, String deliverable)
throws HttpConnectionClosedException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment