Skip to content

Commit 37fadf0

Browse files
committed
Handle empty bytes multipart, close AsyncHttpClient#1089
1 parent 87fde24 commit 37fadf0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/ning/http/client/multipart/MultipartBody.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ private int writeCurrentFile(ByteBuffer buffer) throws IOException {
225225

226226
private int writeCurrentBytes(ByteBuffer buffer, int length) throws IOException {
227227

228+
if (currentBytes.length == 0) {
229+
currentBytesPosition = -1;
230+
currentBytes = null;
231+
return 0;
232+
}
233+
228234
int available = currentBytes.length - currentBytesPosition;
229235

230236
int writeLength = Math.min(available, length);

0 commit comments

Comments
 (0)