You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/01/25 17:56:54 UTC

[tomcat] branch main updated (519403fb8a -> 83801d7d84)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


    from 519403fb8a Fix BZ 66442 - h2 responses without bodies should not use DATA frames
     new 9437efd95b Refactor constants for default priority values
     new 83801d7d84 Add test for new default Chrome priority value

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/coyote/http2/Constants.java        |  3 ---
 java/org/apache/coyote/http2/Stream.java           |  4 ++--
 .../apache/tomcat/util/http/parser/Priority.java   |  7 +++++--
 .../tomcat/util/http/parser/TestPriority.java      | 22 ++++++++++++----------
 4 files changed, 19 insertions(+), 17 deletions(-)
 copy modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestGetConnection.java => test/org/apache/tomcat/util/http/parser/TestPriority.java (64%)


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


[tomcat] 01/02: Refactor constants for default priority values

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9437efd95b137b7bf41b498df444d54ce08fd68f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 25 17:56:32 2023 +0000

    Refactor constants for default priority values
---
 java/org/apache/coyote/http2/Constants.java           | 3 ---
 java/org/apache/coyote/http2/Stream.java              | 4 ++--
 java/org/apache/tomcat/util/http/parser/Priority.java | 7 +++++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/coyote/http2/Constants.java b/java/org/apache/coyote/http2/Constants.java
index e1ee63bb34..26ddba1960 100644
--- a/java/org/apache/coyote/http2/Constants.java
+++ b/java/org/apache/coyote/http2/Constants.java
@@ -18,9 +18,6 @@ package org.apache.coyote.http2;
 
 public class Constants {
 
-    // Prioritisation
-    public static final int DEFAULT_URGENCY = 3;
-    public static final boolean DEFAULT_INCREMENTAL = false;
     // Range 0 to 7 inclusive
     public static final int URGENCY_RANGE = 8;
 
diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java
index a0f997e13a..ae491f6339 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -97,8 +97,8 @@ class Stream extends AbstractNonZeroStream implements HeaderEmitter {
     private Object pendingWindowUpdateForStreamLock = new Object();
     private int pendingWindowUpdateForStream = 0;
 
-    private volatile int urgency = Constants.DEFAULT_URGENCY;
-    private volatile boolean incremental = Constants.DEFAULT_INCREMENTAL;
+    private volatile int urgency = Priority.DEFAULT_URGENCY;
+    private volatile boolean incremental = Priority.DEFAULT_INCREMENTAL;
 
 
     Stream(Integer identifier, Http2UpgradeHandler handler) {
diff --git a/java/org/apache/tomcat/util/http/parser/Priority.java b/java/org/apache/tomcat/util/http/parser/Priority.java
index 0690bd0c41..ce8ec3b8e0 100644
--- a/java/org/apache/tomcat/util/http/parser/Priority.java
+++ b/java/org/apache/tomcat/util/http/parser/Priority.java
@@ -29,9 +29,12 @@ import org.apache.tomcat.util.http.parser.StructuredField.SfListMember;
  */
 public class Priority {
 
+    public static final int DEFAULT_URGENCY = 3;
+    public static final boolean DEFAULT_INCREMENTAL = false;
+
     // Explicitly set the defaults as per RFC 9218
-    private int urgency = 3;
-    private boolean incremental = false;
+    private int urgency = DEFAULT_URGENCY;
+    private boolean incremental = DEFAULT_INCREMENTAL;
 
     public Priority() {
         // Default constructor is NO-OP.


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


[tomcat] 02/02: Add test for new default Chrome priority value

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 83801d7d8482855d3cad43b3e73920b15964b667
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 25 17:56:41 2023 +0000

    Add test for new default Chrome priority value
    
    Reported to be causing issues for some servers
---
 .../tomcat/util/http/parser/TestPriority.java      | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/test/org/apache/tomcat/util/http/parser/TestPriority.java b/test/org/apache/tomcat/util/http/parser/TestPriority.java
new file mode 100644
index 0000000000..eeac940f6e
--- /dev/null
+++ b/test/org/apache/tomcat/util/http/parser/TestPriority.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.http.parser;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestPriority {
+
+    @Test
+    public void testOnlyIncremental() throws Exception {
+        String input = "i";
+        Reader reader = new StringReader(input);
+
+        Priority p = Priority.parsePriority(reader);
+
+        Assert.assertEquals(Priority.DEFAULT_URGENCY, p.getUrgency());
+        Assert.assertTrue(p.getIncremental());
+    }
+}


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