Skip to content

Commit

Permalink
Merge pull request #2206 from zspitzer/LDEV-4634
Browse files Browse the repository at this point in the history
LDEV-4634 avoid NPE in cloneHeaders
  • Loading branch information
michaeloffner authored Aug 14, 2023
2 parents 8200d99 + 1b11e1c commit ec1bc7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/lucee/runtime/net/http/HttpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ public class HttpUtil {
public static Pair<String, String>[] cloneHeaders(HttpServletRequest req) {
List<Pair<String, String>> headers = new ArrayList<Pair<String, String>>();
Enumeration<String> e = req.getHeaderNames(), ee;
String name;
String name, val;
while (e.hasMoreElements()) {
name = e.nextElement();
ee = req.getHeaders(name);
while (ee.hasMoreElements()) {
headers.add(new Pair<String, String>(name, ee.nextElement().toString()));
val = (String) ee.nextElement();
if (val != null) headers.add(new Pair<String, String>(name, val));
}
}
return (Pair<String, String>[]) headers.toArray(new Pair[headers.size()]);
Expand Down

0 comments on commit ec1bc7f

Please sign in to comment.