Skip to content

Commit

Permalink
Merge pull request #32110 from c-classen/main
Browse files Browse the repository at this point in the history
Prevent splitting of cookie header values when using AWS Lambda
  • Loading branch information
patriot1burke authored Mar 28, 2023
2 parents 0f6cf71 + 736ba35 commit b39b85b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public void processResponse(RoutingContext ctx, RoutingContext pending, Buffer b
}
}
}
if (res.getCookies() != null) {
for (String cookie : res.getCookies()) {
response.headers().add("set-cookie", cookie);
}
}
response.setStatusCode(res.getStatusCode());
String body = res.getBody();
if (body != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public void handleMessage(Object msg) {
if (allForName == null || allForName.isEmpty()) {
continue;
}
// Handle cookies separately to preserve commas in the header values
if ("set-cookie".equals(name)) {
responseBuilder.setCookies(allForName);
continue;
}
final StringBuilder sb = new StringBuilder();
for (Iterator<String> valueIterator = allForName.iterator(); valueIterator.hasNext();) {
sb.append(valueIterator.next());
Expand Down

0 comments on commit b39b85b

Please sign in to comment.