Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3775

Cache-Control header provider won't emit the right values if multiple privateFields or noCacheFields are provided

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 2.3.7, 2.4.3, 2.5
    • JAX-RS
    • Novice

    Description

      I was recently basing some code on the org.apache.cxf.jaxrs.impl.CacheControlHeaderProvider and I noticed that it's handling of the no-cache and private fields isn't quite right.

      Current if you have two private fields you would get output like:

      Cache-Control: private="Field1","Field2"

      If you then parse this back into a CacheControl object it would be interpreted as one private field and an extension directive.

      Based on my interpretation of the HTTP 1.1 spec sections:

      http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.1 where 1#field is defined as a comma seperated list of one or more fields and

      http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 where it shows that the list of fields is a optional =, double quote, and a list of fields, and another double quote.

      I think the correct output should be:

      Cache-Control: private="Field1, Field2"

      And of course when parsing a naive splitting based on comma won't work because you have to ignore commas inside the quotes.

      I don't think this is a much-used feature of the Cache-Control system or someone would already have reported this problem.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            dobes_vandermeer Dobes Vandermeer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: