From 98d17bdea9d2f9f037482d99978e5625bfb4221d Mon Sep 17 00:00:00 2001 From: Thomas Becker Date: Thu, 6 Dec 2012 14:15:09 +0100 Subject: 395922: Avoid that SPDY frames containing headers are sent in another order than they have been created --- .../org/eclipse/jetty/spdy/StandardSession.java | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java index bab3b9197c..46a3267835 100644 --- a/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java +++ b/jetty-spdy/spdy-core/src/main/java/org/eclipse/jetty/spdy/StandardSession.java @@ -910,7 +910,7 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable queue.remove(i); if (stream != null && stream.isReset()) { - frameBytes.fail(new StreamException(stream.getId(),StreamStatus.INVALID_STREAM, + frameBytes.fail(new StreamException(stream.getId(), StreamStatus.INVALID_STREAM, "Stream: " + stream + " is reset!")); return; } @@ -942,15 +942,22 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable failure = this.failure; if (failure == null) { - int index = queue.size(); - while (index > 0) + // Frames containing headers must be send in the order the headers have been generated. We don't need + // to do this check in StandardSession.prepend() as no frames containing headers will be prepended. + if (frameBytes instanceof ControlFrameBytes) + queue.addLast(frameBytes); + else { - FrameBytes element = queue.get(index - 1); - if (element.compareTo(frameBytes) >= 0) - break; - --index; + int index = queue.size(); + while (index > 0) + { + FrameBytes element = queue.get(index - 1); + if (element.compareTo(frameBytes) >= 0) + break; + --index; + } + queue.add(index, frameBytes); } - queue.add(index, frameBytes); } } -- cgit v1.2.3