Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5797

'mvn deploy' sends HTTP User-Agent twice

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.1, 3.3.1
    • Fix Version/s: 3.3.3
    • Component/s: Deployment
    • Labels:
      None
    • Environment:
      maven 3.2.1 or later (up to 3.3.1), Java 7, Windows 7 64 bit

      Description

      This may be actually a wagon-http problem but I'm opening it here since maven redistributes wagon-http.

      Steps to reproduce:

      Using maven 3.2.1 or later (i.e. wagon-http 2.6 or later):

      1. unzip attached userAgent.zip
      2. copy simplelogger.properties to $M2_HOME/conf/logging/ (as per instructions
      3. export MAVEN_OPTS="$MAVEN_OPTS -Djava.util.logging.config.file=$M2_HOME/conf/logging/simplelogger.properties"
      4. using pom.xml from attached userAgent.zip:
      mvn -V clean deploy -DaltDeploymentRepository=id::default::<HTTP_DEPLOYMENT_URL>
      

      you can see in the build log that HTTP header "User-Agent" is sent twice:

      FINE: http-outgoing-0 >> User-Agent: Apache-Maven/3.2.1 (Java 1.7.0_67; Windows 7 6.1)
      Apr 02, 2015 1:34:52 PM org.apache.maven.wagon.providers.http.httpclient.headers onRequestSubmitted
      FINE: http-outgoing-0 >> User-Agent: Apache-Maven/3.2.1 (Java 1.7.0_67; Windows 7 6.1)
      Apr 02, 2015 1:34:52 PM org.apache.maven.wagon.providers.http.httpclient.headers onRequestSubmitted
      

      when using maven 3.1.1 or earlier, "User-Agent" is sent only once.

      You could argue that HTTP headers are map keys and sending them twice with the same value should not hurt. However, this causes an issue when deploying to Sonatype Nexus.

      Background: Nexus uses the value of User-Agent to disambiguate deployments from multiple clients into separate staging repos. Nexus concatenates the two values instead, effectively using "<value>, <value>" as staging repo key. Not sure if this is a Nexus bug as well.

        Attachments

        1. userAgent.zip
          1 kB
          Jan Sievers

          Issue Links

            Activity

              People

              • Assignee:
                jvanzyl Jason van Zyl
                Reporter:
                jan.sievers Jan Sievers
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: