Skip to content

Commit

Permalink
Issue #4349 - describe algorithm to negotiate position of internal exts
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Nov 25, 2019
1 parent 38729b9 commit ffcd4c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,13 @@ public void upgrade(HttpResponse response, HttpConnectionOverHTTP httpConnection
}
}

// Put requested internal Extensions into the negotiatedExtension list.
// Insert client requested internal Extensions into the negotiatedExtension list from the server.
// The order of extensions in the response is assumed to be the same as what the client negotiated.
int i = 0;
for (ExtensionConfig reqConfig : requestedExtensions)
{
// If this is an internal extension insert in negotiatedExtensions at position i.
// If this is not an internal extension we must advance i only if this extension was negotiated by the server.
if (reqConfig.isInternalExtension())
negotiatedExtensions.add(i++, reqConfig);
else if (i < negotiatedExtensions.size() && reqConfig.getName().equals(negotiatedExtensions.get(i).getName()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@ public static Stream<Arguments> internalExtensionScenarios() throws Exception
Arguments.of("ext1, ext2, @int1", "ext1, ext2, @int1"),
Arguments.of("@int1, ext1, @int2, ext2, @int3", "@int1, ext1, @int2, ext2, @int3"),
Arguments.of("ext1, ext1, ext1, @int1, ext2", "ext1, @int1, ext2"),
Arguments.of("ext1, @int1, ext1, ext1, ext2", "ext1, @int1, ext2")
Arguments.of("ext1, @int1, ext1, ext1, ext2", "ext1, @int1, ext2"),
Arguments.of("ext1, ext2, ext3, @int1", "ext1, ext2, ext3, @int1")
);
}

Expand Down

0 comments on commit ffcd4c8

Please sign in to comment.