Maven Wagon
  1. Maven Wagon
  2. WAGON-277

HttpClient wagon (wagon-http) uploads all files twice when preemptive authentication is disabled

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-6
    • Fix Version/s: 2.0
    • Component/s: wagon-http
    • Labels:
      None
    • Number of attachments :
      1

      Description

      This causes timeouts and tends to cause invalid checksums for anything that attaches an observer to the stream or connection (Maven does). It seems that the Sun (lightweight-http) wagon sends the first file twice, then caches the authentication after a challenge and uses preemptive auth from then on. This wagon should probably take steps to approximate this strategy, or possibly even improve on it.

      For an example of this, try deploying any artifact to a normal http repository (Nexus uses bare HTTP PUT, for instance) with Maven 2.2.0, and watch the checksums or logs to see how the transfer takes place.

        Issue Links

          Activity

          John Casey made changes -
          Field Original Value New Value
          Link This issue is related to MNG-4235 [ MNG-4235 ]
          John Casey made changes -
          Link This issue is related to MNG-4236 [ MNG-4236 ]
          Brett Porter made changes -
          Fix Version/s 1.x [ 13408 ]
          Brett Porter made changes -
          Fix Version/s 1.x [ 13408 ]
          Fix Version/s 1.0 [ 14468 ]
          Brett Porter made changes -
          Link This issue is related to WAGON-284 [ WAGON-284 ]
          John Casey made changes -
          Link This issue is depended upon by MNG-4301 [ MNG-4301 ]
          Benjamin Bentmann made changes -
          Link This issue relates to WAGON-304 [ WAGON-304 ]
          Benjamin Bentmann made changes -
          Link This issue is related to MNG-4235 [ MNG-4235 ]
          Hide
          Tom Fennelly added a comment -

          Guys, is there a fix or documented workaround for this issue anywhere? I've been jumping around all of these linked JIRAs without any success.

          I've tried using maven 2.2.1 and 3.0.1 and have tried preemptive auth on and off... I've configured both the "httpclient" and "lightweight" wagons in the settings.xml and am still seeing this issue i.e. uploading twice.

          Any help would be appreciated.

          Show
          Tom Fennelly added a comment - Guys, is there a fix or documented workaround for this issue anywhere? I've been jumping around all of these linked JIRAs without any success. I've tried using maven 2.2.1 and 3.0.1 and have tried preemptive auth on and off... I've configured both the "httpclient" and "lightweight" wagons in the settings.xml and am still seeing this issue i.e. uploading twice. Any help would be appreciated.
          Hide
          Chris Tanger added a comment -

          For Nexus users this is related to https://issues.sonatype.org/browse/NEXUS-4347

          Show
          Chris Tanger added a comment - For Nexus users this is related to https://issues.sonatype.org/browse/NEXUS-4347
          Benson Margulies made changes -
          Fix Version/s 1.0 [ 14468 ]
          Hide
          Jari Aarniala added a comment - - edited

          I patched a version of the HTTP wagon for my needs based on the current trunk: https://github.com/codeflows/maven-wagon

          You can configure it to use pre-emptive basic auth (with HttpClient 4, based on the example at http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html) per server like this:

          <server>
            <id>your-server-id</id>
            ...
            <configuration>
              <httpConfiguration>
                <usePreemptiveBasicAuth>true</usePreemptiveBasicAuth>
              </httpConfiguration>
            </configuration>
          </server>
          

          Can't say if this approach is without its problems, but it seems to work for us (i.e. artifacts are only transferred once.)

          This test case sums it up: https://github.com/codeflows/maven-wagon/blob/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java#L43-52

          Show
          Jari Aarniala added a comment - - edited I patched a version of the HTTP wagon for my needs based on the current trunk: https://github.com/codeflows/maven-wagon You can configure it to use pre-emptive basic auth (with HttpClient 4, based on the example at http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html ) per server like this: <server> <id> your-server-id </id> ... <configuration> <httpConfiguration> <usePreemptiveBasicAuth> true </usePreemptiveBasicAuth> </httpConfiguration> </configuration> </server> Can't say if this approach is without its problems, but it seems to work for us (i.e. artifacts are only transferred once.) This test case sums it up: https://github.com/codeflows/maven-wagon/blob/trunk/wagon-providers/wagon-http/src/test/java/org/apache/maven/wagon/providers/http/HttpWagonTest.java#L43-52
          Hide
          Jari Aarniala added a comment -

          Attached patch as well.

          Show
          Jari Aarniala added a comment - Attached patch as well.
          Jari Aarniala made changes -
          Olivier Lamy made changes -
          Link This issue duplicates WAGON-347 [ WAGON-347 ]
          Olivier Lamy made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Assignee Olivier Lamy [ olamy ]
          Fix Version/s 2.0 [ 17379 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Olivier Lamy
              Reporter:
              John Casey
            • Votes:
              12 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: