markt-asf commented on code in PR #811:
URL: https://github.com/apache/tomcat/pull/811#discussion_r1933498993


##########
java/org/apache/coyote/http2/Http2Parser.java:
##########
@@ -327,7 +329,7 @@ protected void readSettingsFrame(int flags, int 
payloadSize, ByteBuffer buffer)
                 long value = ByteUtil.getFourBytes(setting, 2);
                 Setting key = Setting.valueOf(id);
                 if (key == Setting.UNKNOWN) {
-                    log.warn(sm.getString("connectionSettings.unknown", 
connectionId, Integer.toString(id),
+                    log.warn(sm.getString("connectionSettings.unknown", rip + 
"_" + connectionId, Integer.toString(id),
                             Long.toString(value)));

Review Comment:
   The right way to add information to a log message is by adding an additional 
argument to the i18n string.



##########
java/org/apache/coyote/http2/Http2UpgradeHandler.java:
##########
@@ -202,9 +201,19 @@ public void init(WebConnection webConnection) {
             queuedRunnable = new ConcurrentLinkedQueue<>();
         }
 
-        parser = getParser(connectionId);
-
         Stream stream = null;
+        String rip = "-";
+        if (webConnection != null) {
+            try {
+                stream = getStream(1, true);
+                rip = 
stream.getCoyoteRequest().getRequestProcessor().getRemoteAddr();
+               } catch (Http2Exception e) {
+                throw new 
ProtocolException(sm.getString("upgradeHandler.upgrade.fail", connectionId));
+            }
+        }
+
+        parser = getParser(connectionId, rip);
+

Review Comment:
   Duplicates code later in the method.



##########
java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java:
##########
@@ -82,7 +82,7 @@ public void failed(Throwable t, Void attachment) {
     };
 
     @Override
-    protected Http2Parser getParser(String connectionId) {
+    protected Http2Parser getParser(String connectionId, String rip) {
         return new Http2AsyncParser(connectionId, this, this, socketWrapper, 
this);

Review Comment:
   Fails to compile



##########
java/org/apache/coyote/http2/Http2UpgradeHandler.java:
##########
@@ -227,7 +236,8 @@ public void init(WebConnection webConnection) {
                     long value = ByteUtil.getFourBytes(settings, (i * 6) + 2);
                     Setting key = Setting.valueOf(id);
                     if (key == Setting.UNKNOWN) {
-                        log.warn(sm.getString("connectionSettings.unknown", 
connectionId, Integer.toString(id),
+                        String rip = 
stream.getCoyoteRequest().getRequestProcessor().getRemoteAddr();
+                        log.warn(sm.getString("connectionSettings.unknown", 
rip + "_" + connectionId, Integer.toString(id),
                                 Long.toString(value)));

Review Comment:
   Doesn't compile.



##########
java/org/apache/coyote/http2/Http2AsyncParser.java:
##########
@@ -38,7 +38,7 @@ class Http2AsyncParser extends Http2Parser {
     private volatile Throwable error = null;
 
     Http2AsyncParser(String connectionId, Input input, Output output, 
SocketWrapperBase<?> socketWrapper,
-            Http2AsyncUpgradeHandler upgradeHandler) {
+            Http2AsyncUpgradeHandler upgradeHandler,String rip) {
         super(connectionId, input, output);

Review Comment:
   Failed to compile



-- 
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: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to