[ 
https://jira.codehaus.org/browse/WAGON-277?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=273227#comment-273227
 ] 

Jari Aarniala edited comment on WAGON-277 at 7/14/11 7:09 AM:
--------------------------------------------------------------

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:

{code:xml}
<server>
  <id>your-server-id</id>
  ...
  <configuration>
    <httpConfiguration>
      <usePreemptiveBasicAuth>true</usePreemptiveBasicAuth>
    </httpConfiguration>
  </configuration>
</server>
{code}

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

      was (Author: jari):
    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:

{code:xml}
<server>
  <id>your-server-id</id>
  ...
  <configuration>
    <httpConfiguration>
      <usePreemptiveBasicAuth>true</usePreemptiveBasicAuth>
    </httpConfiguration>
  </configuration>
</server>
{code}

Can't say if this approach is without its problems, but it seems to work for us 
(i.e. artifacts are only transferred once.)
  
> HttpClient wagon (wagon-http) uploads all files twice when preemptive 
> authentication is disabled
> ------------------------------------------------------------------------------------------------
>
>                 Key: WAGON-277
>                 URL: https://jira.codehaus.org/browse/WAGON-277
>             Project: Maven Wagon
>          Issue Type: Bug
>          Components: wagon-http
>    Affects Versions: 1.0-beta-6
>            Reporter: John Casey
>            Priority: Critical
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to