K0K0V0K commented on code in PR #8273:
URL: https://github.com/apache/hadoop/pull/8273#discussion_r2851339233
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUtils.java:
##########
@@ -122,4 +127,40 @@ public static void rejectNonHttpRequests(ServletRequest
req) throws
throw new ServletException(E_HTTP_HTTPS_ONLY);
}
}
+
+ /**
+ * Returns the value of a cookie with the given name from the HTTP servlet
request.
+ * Cookie name comparison is case-insensitive. If the request contains no
cookies
+ * or the specified cookie is not present, this method returns {@code null}.
+ *
+ * @param req the HTTP servlet request containing cookies
+ * @param cookieName the name of the cookie to retrieve
+ * @return the cookie value, or {@code null} if not found
+ */
+ public static String getCookie(HttpServletRequest req, String cookieName) {
+ Cookie[] cookies = req.getCookies();
Review Comment:
Thanks @susheelgupta7 for pointing this out.
Currently, this method is only called once, with a jwtCookieName that most
likely has the value "hadoop-jwt". Given this, adding a null check here would
probably just introduce unnecessary noise into the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]