Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/android/com/silkimen/http/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -2489,10 +2490,14 @@ protected HttpRequest copy(final InputStream input, final OutputStream output) t
public HttpRequest run() throws IOException {
final byte[] buffer = new byte[bufferSize];
int read;
while ((read = input.read(buffer)) != -1) {
output.write(buffer, 0, read);
totalWritten += read;
progress.onUpload(totalWritten, totalSize);
try{
while ((read = input.read(buffer)) != -1) {
output.write(buffer, 0, read);
totalWritten += read;
progress.onUpload(totalWritten, totalSize);
}
}catch(EOFException e){
e.printStackTrace();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also be done in the copy(Reader that follows? given it has a similar while ((read = input.read(buffer)) … loop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

return HttpRequest.this;
}
Expand Down