[
https://issues.apache.org/jira/browse/JCR-4570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135927#comment-17135927
]
Julian Reschke edited comment on JCR-4570 at 6/15/20, 2:46 PM:
---------------------------------------------------------------
FWIW, it seems the "classical" HTTP conditional header fields aren't checked at
all, for instance the test below fails:
{noformat}
Index:
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
===================================================================
---
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
(revision 1878856)
+++
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
(working copy)
@@ -60,6 +60,29 @@
}
}
+ public void testPutIfMatchEtag() throws IOException {
+
+ String testuri = this.root + "iftest";
+ HttpPut put = new HttpPut(testuri);
+ try {
+ put = new HttpPut(testuri);
+ String condition = "\"an-etag-this-testcase-invented\"";
+ put.setEntity(new StringEntity("1"));
+ put.setHeader("If-Match", condition);
+ int status = this.client.execute(put,
this.context).getStatusLine().getStatusCode();
+ assertEquals("status: " + status, 412, status);
+ put.releaseConnection();
+
+ }
+ finally {
+ put.releaseConnection();
+ HttpDelete delete = new HttpDelete(testuri);
+ int status = this.client.execute(delete,
this.context).getStatusLine().getStatusCode();
+ assertTrue("status: " + status, status == 200 || status == 204 ||
status == 404);
+ delete.releaseConnection();
+ }
+ }
+
{noformat}
was (Author: reschke):
FWIW, it seems the "classical" HTTP conditional header fields aren't checked at
all, for instance the etst below fails:
Index:
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
===================================================================
---
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
(revision 1878856)
+++
jackrabbit-jcr-server/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918IfHeaderTest.java
(working copy)
@@ -60,6 +60,29 @@
}
}
{noformat}
+ public void testPutIfMatchEtag() throws IOException {
+
+ String testuri = this.root + "iftest";
+ HttpPut put = new HttpPut(testuri);
+ try {
+ put = new HttpPut(testuri);
+ String condition = "\"an-etag-this-testcase-invented\"";
+ put.setEntity(new StringEntity("1"));
+ put.setHeader("If-Match", condition);
+ int status = this.client.execute(put,
this.context).getStatusLine().getStatusCode();
+ assertEquals("status: " + status, 412, status);
+ put.releaseConnection();
+
+ }
+ finally {
+ put.releaseConnection();
+ HttpDelete delete = new HttpDelete(testuri);
+ int status = this.client.execute(delete,
this.context).getStatusLine().getStatusCode();
+ assertTrue("status: " + status, status == 200 || status == 204 ||
status == 404);
+ delete.releaseConnection();
+ }
+ }
+
{noformat}
> WebdavRequestImpl does not check ETags if there is no resource or no
> exclusive write lock
> -----------------------------------------------------------------------------------------
>
> Key: JCR-4570
> URL: https://issues.apache.org/jira/browse/JCR-4570
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-webdav
> Reporter: Manfred Baedke
> Assignee: Manfred Baedke
> Priority: Minor
> Attachments: JCR-4570.patch
>
>
> Also other lock types are completely ignored.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)