File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
src/main/java/com/ning/http/client/providers/netty/request/body Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -49,22 +49,21 @@ public boolean hasNextChunk() throws Exception {
49
49
}
50
50
51
51
public Object nextChunk () throws Exception {
52
- if (endOfInput ) {
52
+ if (endOfInput )
53
+ return null ;
54
+
55
+ ByteBuffer buffer = ByteBuffer .allocate (chunkSize );
56
+ long r = body .read (buffer );
57
+ if (r < 0L ) {
58
+ endOfInput = true ;
59
+ return null ;
60
+ } else if (r == 0 && body instanceof FeedableBodyGenerator .PushBody ) {
61
+ //this will suspend the stream in ChunkedWriteHandler
53
62
return null ;
54
63
} else {
55
- ByteBuffer buffer = ByteBuffer .allocate (chunkSize );
56
- long r = body .read (buffer );
57
- if (r < 0L ) {
58
- endOfInput = true ;
59
- return null ;
60
- } else if (r == 0 && body instanceof FeedableBodyGenerator .PushBody ) {
61
- //this will suspend the stream in ChunkedWriteHandler
62
- return null ;
63
- } else {
64
- endOfInput = r == contentLength || r < chunkSize && contentLength > 0 ;
65
- buffer .flip ();
66
- return ChannelBuffers .wrappedBuffer (buffer );
67
- }
64
+ endOfInput = r == contentLength || r < chunkSize && contentLength > 0 ;
65
+ buffer .flip ();
66
+ return ChannelBuffers .wrappedBuffer (buffer );
68
67
}
69
68
}
70
69
You can’t perform that action at this time.
0 commit comments