charles kim created MRM-1644:
--------------------------------

             Summary: Archiva should set cache control headers instead of 
adding for maven-metadata.xml
                 Key: MRM-1644
                 URL: https://jira.codehaus.org/browse/MRM-1644
             Project: Archiva
          Issue Type: Bug
    Affects Versions: 1.4-M1
         Environment: RHEL 6
            Reporter: charles kim
         Attachments: ArchivaDavResourceFactory_patch.txt, 
ArchivaDavResourceFactoryTest_patch.txt

Looks like there might be an issue with how cache control header is added. This 
should use setHeader instead of an addHeader to protect against adding 
duplicate headers.

  private void setHeaders( DavServletResponse response, DavResourceLocator 
locator, DavResource resource )
    {
        // [MRM-503] - Metadata file need Pragma:no-cache response
        // header.
        if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) )
        {
            response.addHeader( "Pragma", "no-cache" );
            response.addHeader( "Cache-Control", "no-cache" );
        }

        // We need to specify this so connecting wagons can work correctly
        response.addDateHeader( "last-modified", resource.getModificationTime() 
);

        // TODO: [MRM-524] determine http caching options for other types of 
files (artifacts, sha1, md5, snapshots)
    }

See below for a sample result with duplicate header.  Cache control header with 
public was added through servlet filter but then another cache control header 
got added.  Expected result should be that it should overwrite the exiting 
header:

< HTTP/1.1 200 OK
< Cache-Control: public, max-age=600, s-maxage=600 < Pragma: no-cache < 
Cache-Control: no-cache < Last-Modified: Thu, 19 Jul 2012 22:09:53 GMT < 
Content-Length: 3376 < Vary: Accept-Encoding < Connection: close < 
Content-Type: application/xml;charset=UTF-8


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to