(tomcat) branch main updated: Fix javadoc

2024-10-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 300e2e21fd Fix javadoc
300e2e21fd is described below

commit 300e2e21fde610851f4aae11b4a3047779323731
Author: remm 
AuthorDate: Sun Oct 20 14:29:27 2024 +0200

Fix javadoc
---
 java/org/apache/tomcat/util/http/WebdavIfHeader.java | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/WebdavIfHeader.java 
b/java/org/apache/tomcat/util/http/WebdavIfHeader.java
index fbca45cdfc..77ab27ec13 100644
--- a/java/org/apache/tomcat/util/http/WebdavIfHeader.java
+++ b/java/org/apache/tomcat/util/http/WebdavIfHeader.java
@@ -142,10 +142,7 @@ public class WebdavIfHeader {
 }
 
 /**
- * Return {@link DavConstants#HEADER_IF If}
- *
- * @return {@link DavConstants#HEADER_IF If}
- * @see DavConstants#HEADER_IF
+ * @return If String.
  */
 public String getHeaderName() {
 return "If";


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



(tomcat) branch main updated: Refine the dead properties handling

2024-10-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 40c094b8ba Refine the dead properties handling
40c094b8ba is described below

commit 40c094b8ba52513b1468a45db0d9ad0c36a64fbf
Author: remm 
AuthorDate: Sun Oct 20 23:46:05 2024 +0200

Refine the dead properties handling

Add a proof of concept otherwise it is not possible to validate it.
Add namespaces on elments to the DOMWriter.
---
 .../servlets/TransientPropertiesWebdavServlet.java | 186 +
 .../apache/catalina/servlets/WebdavServlet.java|  71 ++--
 java/org/apache/catalina/util/DOMWriter.java   |  12 +-
 .../catalina/servlets/TestWebdavServlet.java   |  84 --
 4 files changed, 286 insertions(+), 67 deletions(-)

diff --git 
a/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java 
b/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java
new file mode 100644
index 00..80c979c190
--- /dev/null
+++ b/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java
@@ -0,0 +1,186 @@
+/*
+ * 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.catalina.servlets;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.concurrent.ConcurrentHashMap;
+
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.util.DOMWriter;
+import org.apache.catalina.util.XMLWriter;
+import org.w3c.dom.Node;
+
+/**
+ * Extended WebDAV Servlet that implements dead properties using storage in 
memory.
+ */
+public class TransientPropertiesWebdavServlet extends WebdavServlet {
+
+private static final long serialVersionUID = 1L;
+
+private final ConcurrentHashMap> deadProperties = 
new ConcurrentHashMap<>();
+
+@Override
+protected void doOptions(HttpServletRequest req, HttpServletResponse resp) 
throws ServletException, IOException {
+resp.addHeader("DAV", "1,2,3");
+resp.addHeader("Allow", determineMethodsAllowed(req));
+resp.addHeader("MS-Author-Via", "DAV");
+}
+
+@Override
+protected void proppatchResource(String path, 
ArrayList operations) {
+boolean protectedProperty = false;
+// Check for the protected properties
+for (ProppatchOperation operation : operations) {
+if (operation.getProtectedProperty()) {
+protectedProperty = true;
+operation.setStatusCode(HttpServletResponse.SC_FORBIDDEN);
+}
+}
+if (protectedProperty) {
+for (ProppatchOperation operation : operations) {
+if (!operation.getProtectedProperty()) {
+operation.setStatusCode(WebdavStatus.SC_FAILED_DEPENDENCY);
+}
+}
+} else {
+ArrayList properties = deadProperties.get(path);
+if (properties == null) {
+properties = new ArrayList();
+deadProperties.put(path, properties);
+}
+synchronized (properties) {
+for (ProppatchOperation operation : operations) {
+if (operation.getUpdateType() == PropertyUpdateType.SET) {
+Node node = 
operation.getPropertyNode().cloneNode(true);
+boolean found = false;
+for (int i = 0; i < properties.size(); i++) {
+Node propertyNode = properties.get(i);
+if (propertyEquals(node, propertyNode)) {
+found = true;
+properties.set(i, node);
+break;
+}
+}
+if (!found) {
+properties.add(node);
+}
+} if (operation.getUpdateType() == 
PropertyUpdateType.REMOVE) {
+

Buildbot success in on tomcat-12.0.x

2024-10-20 Thread buildbot
Build status: Build succeeded!
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/120/builds/146
Blamelist: remm 
Build Text: build successful
Status Detected: restored build
Build Source Stamp: [branch main] 300e2e21fde610851f4aae11b4a3047779323731


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 1

  shell_7: 0

  shell_8: 0

  shell_9: 0

  shell_10: 0

  Rsync docs to nightlies.apache.org: 0

  shell_11: 0

  Rsync RAT to nightlies.apache.org: 0

  compile_1: 1

  shell_12: 0

  Rsync Logs to nightlies.apache.org: 0


-- ASF Buildbot


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



(tomcat) branch main updated: Implement WebDAV If header processing

2024-10-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/main by this push:
 new 45a8d532d0 Implement WebDAV If header processing
45a8d532d0 is described below

commit 45a8d532d0e1de7e1ccaedc820f09b4f3ffba877
Author: remm 
AuthorDate: Sun Oct 20 14:13:01 2024 +0200

Implement WebDAV If header processing

Uses code from Apache Jackrabbit.
Add strict flag for the if header processing since some edge situations
are annoying.
Fix shared locks entry in the main lock map, and prevent its expiration.
Fix non compliant lock renewal (needed a request on the locked
resource).
Fix a couple instance of missing lock depth checks and shared lock
matching issue.
Lockdiscovery is supposed to be there even if there are no locks.
---
 .../apache/catalina/servlets/WebdavServlet.java| 344 ++--
 .../tomcat/util/http/LocalStrings.properties   |   3 +
 .../apache/tomcat/util/http/WebdavIfHeader.java| 943 +
 .../catalina/servlets/TestWebdavServlet.java   | 161 +++-
 webapps/docs/changelog.xml |   4 +
 5 files changed, 1370 insertions(+), 85 deletions(-)

diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java 
b/java/org/apache/catalina/servlets/WebdavServlet.java
index fd12574655..15f5d398d6 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -31,6 +31,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
 import java.util.Deque;
+import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
@@ -60,6 +61,7 @@ import org.apache.tomcat.util.buf.HexUtils;
 import org.apache.tomcat.util.http.ConcurrentDateFormat;
 import org.apache.tomcat.util.http.FastHttpDateFormat;
 import org.apache.tomcat.util.http.RequestUtil;
+import org.apache.tomcat.util.http.WebdavIfHeader;
 import org.apache.tomcat.util.security.ConcurrentMessageDigest;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -204,6 +206,19 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 protected static final String DEFAULT_NAMESPACE = "DAV:";
 
 
+/**
+ * Supported locks.
+ */
+protected static final String SUPPORTED_LOCKS =
+"" +
+"" +
+"" +
+"" +
+"" +
+"" +
+"" +
+"";
+
 /**
  * Simple date format for the creation date ISO representation (partial).
  */
@@ -243,6 +258,12 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 private boolean allowSpecialPaths = false;
 
 
+/**
+ * Is the if header processing strict.
+ */
+private boolean strictIfProcessing = false;
+
+
 // - Public Methods
 
 @Override
@@ -273,6 +294,10 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 if (getServletConfig().getInitParameter("allowSpecialPaths") != null) {
 allowSpecialPaths = 
Boolean.parseBoolean(getServletConfig().getInitParameter("allowSpecialPaths"));
 }
+
+if (getServletConfig().getInitParameter("strictIfProcessing") != null) 
{
+strictIfProcessing = 
Boolean.parseBoolean(getServletConfig().getInitParameter("strictIfProcessing"));
+}
 }
 
 
@@ -302,7 +327,6 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 }
 }
 
-
 // -- Protected Methods
 
 /**
@@ -404,7 +428,97 @@ public class WebdavServlet extends DefaultServlet 
implements PeriodicEventListen
 return false;
 }
 
-// FIXME : Process the WebDAV If header
+// Process the WebDAV If header using Apache Jackrabbit code
+String ifHeaderValue = request.getHeader("If");
+if (ifHeaderValue != null) {
+WebdavIfHeader ifHeader = new 
WebdavIfHeader(getUriPrefix(request), ifHeaderValue);
+if (!ifHeader.hasValue()) {
+// Allow bad if syntax, will only be used for lock tokens
+return !strictIfProcessing;
+}
+String path = getRelativePath(request);
+// Get all hrefs from the if header
+Iterator hrefs = ifHeader.getResources();
+
+String currentPath = null;
+String currentHref = null;
+WebResource currentWebResource = null;
+if (hrefs.hasNext()) {
+currentHref = hrefs.next();
+currentPath = getPathFromHref(currentHref, request);
+currentWebResource = resources.getResource(currentPat

Buildbot failure in on tomcat-12.0.x

2024-10-20 Thread buildbot
Build status: BUILD FAILED: compile (failure)
Worker used: bb_worker2_ubuntu
URL: https://ci2.apache.org/#builders/120/builds/145
Blamelist: remm 
Build Text: compile (failure)
Status Detected: new failure
Build Source Stamp: [branch main] 45a8d532d0e1de7e1ccaedc820f09b4f3ffba877


Steps:

  worker_preparation: 0

  git: 0

  shell: 0

  shell_1: 0

  shell_2: 0

  shell_3: 0

  shell_4: 0

  shell_5: 0

  shell_6: 0

  compile: 2


-- ASF Buildbot


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