} else {
request.setStartTime(System.currentTimeMillis());
keptAlive = true;
- inputBuffer.parseHeaders();
+ // Currently only NIO will ever return false here
+ if (!inputBuffer.parseHeaders()) {
+ // We've read part of the request, don't recycle it
+ // instead associate it with the socket
+ openSocket = true;
+ readComplete = false;
+ break;
+ }
if (!disableUploadTimeout) {
Socket.timeoutSet(socketRef,
connectionUploadTimeout * 1000);
} else {
request.setStartTime(System.currentTimeMillis());
keptAlive = true;
- if ( !inputBuffer.parseHeaders() ) {
- //we've read part of the request, don't recycle it
- //instead associate it with the socket
+ // Currently only NIO will ever return false here
+ if (!inputBuffer.parseHeaders()) {
+ // We've read part of the request, don't recycle it
+ // instead associate it with the socket
openSocket = true;
readComplete = false;
break;
keptAlive = true;
// Reset timeout for reading headers
socket.getSocket().setSoTimeout(endpoint.getSoTimeout());
- inputBuffer.parseHeaders();
+ // Currently only NIO will ever return false here
+ if (!inputBuffer.parseHeaders()) {
+ // We've read part of the request, don't recycle it
+ // instead associate it with the socket
+ openSocket = true;
+ readComplete = false;
+ break;
+ }
if (!disableUploadTimeout) {
socket.getSocket().setSoTimeout(connectionUploadTimeout);
}