Skip to content

Commit

Permalink
Merge pull request #11 from jenkinsci/JENKINS-50668
Browse files Browse the repository at this point in the history
[JENKINS-50668] Prevent loading file in memory on upload
  • Loading branch information
jglick committed Apr 9, 2018
2 parents 721f991 + cfe56d3 commit 4327ac8
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -349,6 +349,7 @@ private static void uploadFile(Path f, URL url) throws IOException {
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setFixedLengthStreamingMode(Files.size(f)); // prevent loading file in memory
try (OutputStream out = connection.getOutputStream()) {
Files.copy(f, out);
}
Expand Down

0 comments on commit 4327ac8

Please sign in to comment.