if (request.getMethod().equals("HEAD")) _response.setNoBody();
    public Response fetchResponse(Request request) throws IOException {        if (_response != null) {            _response.flushContentStream(); // flush the content stream, just in case it wasn't read            _response = null;        };        if (request == null) {            _logger.severe("Asked to fetch a null request");            return null;        }        HttpUrl url = request.getURL();        if (url == null) {            _logger.severe("Asked to fetch a request with a null URL");            return null;        }                if (invalidSocket(url)) {            String proxyAuth = request.getHeader("Proxy-Authorization");            _socket = opensocket(url, proxyAuth);            if (_response != null) { // there was an error opening the socket                return _response;            } else {                _in = _socket.getInputStream();                _out = _socket.getOutputStream();            }        }        // Still send the real request        if (_out != null) { // we are connected to a live server            _logger.fine("Writing the request");            // depending on whether we are connected directly to the server, or via a proxy            if (_direct) {                request.writeDirect(_out);            } else {                request.write(_out);            }            _out.flush();            _logger.fine("Finished writing the request");        } else {            // we make sure that the request body has been read (if any)            request.flushContentStream();        }                _response = new Response();        _response.setRequest(request);                // test for spurious 100 header from IIS 4 and 5.        // See http://mail.python.org/pipermail/python-list/2000-December/023204.html        _logger.fine("Reading the response");        do {            _response.read(_in);        } while (_response.getStatus().equals("100"));                _logger.info(request.getURL() +" : " + _response.getStatusLine());                String connection = _response.getHeader("Proxy-Connection");        if (connection != null && "close".equalsIgnoreCase(connection)) {            _in = null;            _out = null;            // do NOT close the socket itself, since the message body has not yet been read!        } else {            connection = _response.getHeader("Connection");            String version = request.getVersion();            if (version.equals("HTTP/1.0") && "Keep-alive".equalsIgnoreCase(connection)) {                _lastRequestTime = System.currentTimeMillis();            } else if (version.equals("HTTP/1.1") && (connection == null || !connection.equalsIgnoreCase("Close"))) {                _lastRequestTime = System.currentTimeMillis();            } else {                _in = null;                _out = null;                // do NOT close the socket itself, since the message body has not yet been read!            }        }        return _response;    }