You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2020/03/19 08:14:21 UTC

[maven-wagon] 01/01: Add code for streaming failures

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch WAGON-584_streaming
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit 241af6e14b412c4a3c7b9db5313a6f81426bbd7c
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Thu Mar 19 09:13:56 2020 +0100

    Add code for streaming failures
---
 .../maven/wagon/providers/http/LightweightHttpWagon.java       | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
index 82981c9..c4341bc 100644
--- a/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
+++ b/wagon-providers/wagon-http-lightweight/src/main/java/org/apache/maven/wagon/providers/http/LightweightHttpWagon.java
@@ -249,9 +249,19 @@ public class LightweightHttpWagon
             putConnection = (HttpURLConnection) url.openConnection( this.proxy );
 
             addHeaders( putConnection );
+            putConnection.setRequestProperty( "Expect", "100-continue" );
 
             putConnection.setRequestMethod( "PUT" );
             putConnection.setDoOutput( true );
+
+            if ( resource.getContentLength() != -1 )
+            {
+                putConnection.setFixedLengthStreamingMode( resource.getContentLength() );
+            }
+            else
+            {
+                putConnection.setChunkedStreamingMode( 0 );
+            }
             outputData.setOutputStream( putConnection.getOutputStream() );
         }
         catch ( IOException e )