Bug 535780 (RHQ-2440)

Summary: Agent jar shouldn't be cached on client browser
Product: [Other] RHQ Project Reporter: Mark Drilling <mdrillin>
Component: UsabilityAssignee: John Mazzitelli <mazz>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: cwelton, mazz, mfoley, minamoto
Target Milestone: ---Keywords: FutureFeature, Improvement
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-2440
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-02 07:27:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 585306    

Description Mark Drilling 2009-09-24 19:33:00 UTC
This problem came up from customer problem report:
From a newly installed JON 2.3 server, the browser will download "rhq-enterprise-agent-1.2.0.GA.jar" because the browser cached the agent jar previously installed. Please note the download URL is "http://<host>:7080/agentupdate/download" and the URL doesn't have the file name.

I didn't notice that 1.2.0.GA jar was the old one when I installed it.  I installed the 1.2 jar - running the rhq-agent.sh, I got the following:

[fminamot@localhost bin]$ ./rhq-agent.sh
RHQ 1.2.0.GA [3862] (null)
This version of the agent is not supported by the server - an agent update must be applied
The agent update thread has started - will begin the agent auto-update now!
The agent will wait for [5] threads to die
Failed to start the agent
at org.rhq.enterprise.agent.AgentMain.waitForServer(AgentMain.java:1518)
at org.rhq.enterprise.agent.AgentMain.start(AgentMain.java:619)
at org.rhq.enterprise.agent.AgentMain.main(AgentMain.java:398)
Downloaded the agent update binary to [/home/fminamot/jboss/rhq-enterprise-agent-1.3.0.GA.jar]
Missing the envvar [RHQ_AGENT_JAVA_EXE_FILE_PATH] - will try to find a Java executable to use.
Will use the Java executable [/usr/java/jdk1.6.0_16/jre/bin/java]
Now executing agent update - if all goes well, this is the last you will hear of this agent: [ProcessExecution: executable=[/usr/java/jdk1.6.0_16/jre/bin/java], args=[[-jar, /home/fminamot/jboss/rhq-enterprise-agent-1.3.0.GA.jar, --pause=20000, --update=/home/fminamot/jboss/rhq-agent]], env-vars=[null], working-dir=[/home/fminamot/jboss], wait=[0], capture-output=[false], kill-on-timeout=[false], executable-is-command=[true]]

Proposed Solution:
RHQ server should add "no-cache" to the download response header in order to prevent caching the agent jar.

We can avoid this trouble by cleaning the browser cache before installation but there is a better way to disable cache by the server side [1][2].

So I think RHQ server should add "no-cache" to the download response header in order to prevent caching the agent jar.

[1] http://blog.httpwatch.com/2008/10/15/two-important-differences-between-firefox-and-ie-caching/
[2] http://onjava.com/onjava/excerpt/jebp_3/index2.html

Current HTTP request/response are as follows:

GET /agentupdate/download HTTP/1.0

User-Agent: Wget/1.11.4 (Red Hat modified)

Accept: */*


Connection: Keep-Alive

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

X-Powered-By: Servlet 2.4; JBoss-4.2.0.CR2 (build: SVNTag=JBoss_4_2_0_CR2 date=200704160918)/Tomcat-5.5

Content-Disposition: attachment; filename=rhq-enterprise-agent-1.3.0.GA.jar

Last-Modified: Thu, 17 Sep 2009 03:28:46 GMT

Content-Type: application/octet-stream

Content-Length: 9883586

Date: Thu, 24 Sep 2009 04:24:41 GMT

Connection: keep-alive

Comment 1 Red Hat Bugzilla 2009-11-10 21:04:30 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2440

Comment 2 wes hayutin 2010-02-16 17:10:13 UTC
mass add of key word FutureFeature to help track

Comment 3 John Mazzitelli 2011-02-17 17:03:58 UTC
i thought I added all the different no cache headers to the response. I'll double check this.

Comment 4 John Mazzitelli 2011-02-18 20:47:52 UTC
git commit 1aacb18

I added the following response headers, which should disable caching:

Cache-Control: no-cache, no-store
Expires: -1
Pragma: no-cache

I added this on all the download servlets - agent, CLI, bundle deployer tool and connectors.

Comment 5 Mike Foley 2011-04-20 19:07:07 UTC
documenting the response headers as follows (from FF Firebug)

Pragma	no-cache
Cache-Control	no-cache


Comment 6 Heiko W. Rupp 2013-09-02 07:27:04 UTC
Bulk closing of issues that were VERIFIED, had no target release and where the status changed more than a year ago.