public boolean makeReusable(boolean streamCanceled, OutputStream requestBodyOut, InputStream responseBodyIn) { if (streamCanceled) { return false; } // We cannot reuse sockets that have incomplete output. if (requestBodyOut != null && !((AbstractOutputStream) requestBodyOut).isClosed()) { return false; } // If the request specified that the connection shouldn't be reused, don't reuse it. if (httpEngine.requestHeaders.hasConnectionClose()) { return false; } // If the response specified that the connection shouldn't be reused, don't reuse it. if (httpEngine.responseHeaders != null && httpEngine.responseHeaders.hasConnectionClose()) { return false; } if (responseBodyIn instanceof UnknownLengthHttpInputStream) { return false; } if (responseBodyIn != null) { return discardStream(httpEngine, responseBodyIn); } return true; }
public boolean makeReusable(boolean streamCancelled, OutputStream requestBodyOut, InputStream responseBodyIn) { if (streamCancelled) { return false; } // We cannot reuse sockets that have incomplete output. if (requestBodyOut != null && !((AbstractOutputStream) requestBodyOut).isClosed()) { return false; } // If the request specified that the connection shouldn't be reused, don't reuse it. if (httpEngine.requestHeaders.hasConnectionClose()) { return false; } // If the response specified that the connection shouldn't be reused, don't reuse it. if (httpEngine.responseHeaders != null && httpEngine.responseHeaders.hasConnectionClose()) { return false; } if (responseBodyIn instanceof UnknownLengthHttpInputStream) { return false; } if (responseBodyIn != null) { return discardStream(httpEngine, responseBodyIn); } return true; }