You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Julian Reschke (JIRA)" <ji...@apache.org> on 2008/10/06 12:49:44 UTC

[jira] Created: (JCR-1785) If header checking lacks etag checks

If header checking lacks etag checks
------------------------------------

                 Key: JCR-1785
                 URL: https://issues.apache.org/jira/browse/JCR-1785
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-webdav
            Reporter: Julian Reschke


The evaluation of the WebDAV If header seems to lack Etag checks. For instance, this test case:


    public void testPutIfEtag() throws HttpException, IOException, DavException, URISyntaxException {
  
        String testuri = this.root + "iftest";
    
        int status;
        try {
            PutMethod put = new PutMethod(testuri);
            String condition = "<" + testuri + "> ([" + "\"an-etag-this-testcase-invented\"" + "])";
            put.setRequestEntity(new StringRequestEntity("1"));
            put.setRequestHeader("If", condition);
            status = this.client.executeMethod(put);
            assertEquals("status: " + status, 412, status);
        }
        finally {
            DeleteMethod delete = new DeleteMethod(testuri);
            status = this.client.executeMethod(delete);
            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
        }
    }

fails, as the PUT request gets executed, although it should have been rejected with Precondition Failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1785) If header checking lacks etag checks

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12638271#action_12638271 ] 

Julian Reschke commented on JCR-1785:
-------------------------------------

Further observations:

- tagged lists are implemented by using a map, mapping the simple-ref to conditions; this is good. However, the simple-refs are copied verbatim, but later on are string-compared, which fails when, for instance, the simple-ref was an absoluteURI ("http://example.com/foo" does not equal "/foo").

- this problem is hidden by the fact that for tagged lists, entries not matching the requested resource are simple ignored -- they need to be evaluated, and if the evaluation fails the request needs to fail with 412.



> If header checking lacks etag checks
> ------------------------------------
>
>                 Key: JCR-1785
>                 URL: https://issues.apache.org/jira/browse/JCR-1785
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-webdav
>            Reporter: Julian Reschke
>
> The evaluation of the WebDAV If header seems to lack Etag checks. For instance, this test case:
>     public void testPutIfEtag() throws HttpException, IOException, DavException, URISyntaxException {
>   
>         String testuri = this.root + "iftest";
>     
>         int status;
>         try {
>             PutMethod put = new PutMethod(testuri);
>             String condition = "<" + testuri + "> ([" + "\"an-etag-this-testcase-invented\"" + "])";
>             put.setRequestEntity(new StringRequestEntity("1"));
>             put.setRequestHeader("If", condition);
>             status = this.client.executeMethod(put);
>             assertEquals("status: " + status, 412, status);
>         }
>         finally {
>             DeleteMethod delete = new DeleteMethod(testuri);
>             status = this.client.executeMethod(delete);
>             assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
>         }
>     }
> fails, as the PUT request gets executed, although it should have been rejected with Precondition Failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1785) If header checking lacks etag checks

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637080#action_12637080 ] 

Julian Reschke commented on JCR-1785:
-------------------------------------

Futhermore, If header evaluation seems also to ignore URIs in the Tagged-list production.



> If header checking lacks etag checks
> ------------------------------------
>
>                 Key: JCR-1785
>                 URL: https://issues.apache.org/jira/browse/JCR-1785
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-webdav
>            Reporter: Julian Reschke
>
> The evaluation of the WebDAV If header seems to lack Etag checks. For instance, this test case:
>     public void testPutIfEtag() throws HttpException, IOException, DavException, URISyntaxException {
>   
>         String testuri = this.root + "iftest";
>     
>         int status;
>         try {
>             PutMethod put = new PutMethod(testuri);
>             String condition = "<" + testuri + "> ([" + "\"an-etag-this-testcase-invented\"" + "])";
>             put.setRequestEntity(new StringRequestEntity("1"));
>             put.setRequestHeader("If", condition);
>             status = this.client.executeMethod(put);
>             assertEquals("status: " + status, 412, status);
>         }
>         finally {
>             DeleteMethod delete = new DeleteMethod(testuri);
>             status = this.client.executeMethod(delete);
>             assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
>         }
>     }
> fails, as the PUT request gets executed, although it should have been rejected with Precondition Failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.