private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }
private static boolean checkKeepAlive(final HttpResponsePacket response) { final int statusCode = response.getStatus(); final boolean isExpectContent = response.isExpectContent(); boolean keepAlive = !statusDropsConnection(statusCode) || (!isExpectContent || !response.isChunked() || response.getContentLength() == -1); // double-check the transfer encoding here if (keepAlive) { // Check the Connection header final DataChunk cVal = response.getHeaders().getValue(Header.Connection); if (response.getProtocol().compareTo(Protocol.HTTP_1_1) < 0) { // HTTP 1.0 response // "Connection: keep-alive" should be specified explicitly keepAlive = cVal != null && cVal.equalsIgnoreCase(KEEPALIVE_BYTES); } else { // HTTP 1.1+ // keep-alive by default, if there's no "Connection: close" keepAlive = cVal == null || !cVal.equalsIgnoreCase(CLOSE_BYTES); } } return keepAlive; }