Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5752

slave.jar download URL causes a redirect to/jnlpJars/slave.jar/ (note trailing slash)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • remoting
    • None
    • CentOS 5.4, Tomcat 6.0.18

      Here's the HTTP headers I see when retrieving $HUDSON_URL/jnlpJars/slave.jar:

      HTTP/1.1 302 Moved Temporarily
      Date: Wed, 24 Feb 2010 21:51:10 GMT
      Server: Apache/2.2.3
      Location: http://hudson/jnlpJars/slave.jar/
      Content-Type: application/java-archive
      

      And after following the 302 redirect to $HUDSON_URL/jnlpJars/slave.jar/:

      HTTP/1.1 200 OK
      Date: Wed, 24 Feb 2010 21:51:02 GMT
      Server: Apache/2.2.3
      Content-Disposition: attachment; filename=slave.jar
      Last-Modified: Sat, 20 Feb 2010 00:28:22 GMT
      Expires: Sat, 20 Feb 2010 00:28:22 GMT
      Accept-Ranges: bytes
      Content-Length: 213820
      Content-Type: application/java-archive
      

      I'm writing a custom script to bootstrap slave nodes that essentially calls wget on the master server to get the slave.jar, saves it off somewhere, and runs slave.jar. I noticed the redirect when using wget, because it causes two problems:

      1. By default, the file will be saved as index.html instead of slave.jar. This can be overridden by adding -O slave.jar to the wget command-line.
      2. Wget's conditional GET support (-N) using the timestamp of the file doesn't work - it always follows the redirect and gets the file, so I'm stuck downloading that 200K slave.jar regardless of whether it's the most recent version or not.

      I can work around the former issue and live with the latter, but it'd be nice to have this fixed.

          [JENKINS-5752] slave.jar download URL causes a redirect to/jnlpJars/slave.jar/ (note trailing slash)

          Andrew Bayer added a comment -

          Looks to me like this is a result of how Stapler handles paths - assigning to kohsuke.

          Andrew Bayer added a comment - Looks to me like this is a result of how Stapler handles paths - assigning to kohsuke.

          Code changed in hudson
          User: : kohsuke
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/Hudson.java
          trunk/hudson/main/core/src/main/java/hudson/model/Slave.java
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/31911
          Log:
          [FIXED JENKINS-5752] Avoid pointless and harmful redirection when downloading slave.jar.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : kohsuke Path: trunk/hudson/main/core/src/main/java/hudson/model/Hudson.java trunk/hudson/main/core/src/main/java/hudson/model/Slave.java trunk/www/changelog.html http://jenkins-ci.org/commit/31911 Log: [FIXED JENKINS-5752] Avoid pointless and harmful redirection when downloading slave.jar.

            kohsuke Kohsuke Kawaguchi
            natacado natacado
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: