Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-713

Loss of precision in date comparison when If-Unmodified-Since header is used with GET requests

    XMLWordPrintable

Details

    • Low

    Description

      This is the test case that fails:

      PUT uri1
      GET uri1
      dateLast = Last-Modified header from last GET response
      GET uri1 (with header If-Unmodified-Since: dateLast)
      should get normal entity response, getting code 412(Precondition Failed) instead
      (the 412 should be returned when the date in If-Unmodified-Since is sooner than the stored value but not equal)

      The infinispan REST server uses org.jboss.resteasy.specimpl.RequestImpl to decide the preconditions
      the issue concerns the date comparation on line 156: if (date.getTime() >= lastModified.getTime())
      date - date that was obtained from the request header If-Unmodified-Since
      lastModified - the lastmodified date that was stored in MIMECacheEntry

      the thing is that lastModified contains also milliseconds whereas date doesn't, it has them zeroed, because it's been just parsed from string.
      lastModified contains the milliseconds because the way it's created in MIMECacheEntry constructor during PUT request ( System.currentTimeMillis() )

      The milliseconds from the lastModified in MIMECacheEntry should be discarded before the comparation.

      Attachments

        Issue Links

          Activity

            People

              manik_jira Manik Surtani (Inactive)
              manik_jira Manik Surtani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: