response.read(_in);
do { response.read(_in); } while (response.getStatus().equals("100"));
    public Response fetchResponse(Request request) {        if (request == null) {            System.err.println("Request is null");            return null;        }                try {            if (_in == null || _out == null || invalidSocket(request)) {                Response response = opensocket(request);                if (response != null) {                    return response;                }            }        } catch (UnknownHostException uhe) {            return errorResponse(request, "Unknown host exception " + uhe);        } catch (IOException ioe) {            return errorResponse(request, "IOException " + ioe);        }        // Still send the real request        try {            // FIXME : we don't handle gzipped content properly yet. I"ve seen problems with content-length, etc            request.deleteHeader("Accept-Encoding");                        // depending on whether we are connected directly to the server, or via a proxy            if (_proxysocket != null) {                request.write(_out);            } else if (_serversocket != null) {                request.writeDirect(_out);            }            _out.flush();                        Response response = new Response();            response.setRequest(request);            response.read(_in);            String length = response.getHeader("Content-Length");            if (length != null) {                try {                    int cl = Integer.parseInt(length);                    response.setContentStream(new FixedLengthInputStream(response.getContentStream(),cl));                } catch (NumberFormatException nfe) {                    System.err.println("NumberFormatException parsing content length = '" + length + "'\n " + nfe);                }            }            String chunked = response.getHeader("Transfer-Encoding");            if (chunked != null && chunked.equalsIgnoreCase("chunked")) {                response.setContentStream(new ChunkedInputStream(response.getContentStream()));                response.deleteHeader("Transfer-Encoding");                response.setHeader("X-Transfer-Encoding", chunked);            }            String gzipped = response.getHeader("Content-Encoding");            if (gzipped != null && gzipped.equalsIgnoreCase("gzip")) {                response.setContentStream(new GZIPInputStream(response.getContentStream()));                response.deleteHeader("Content-Encoding");                response.setHeader("X-Content-Encoding", gzipped);            }            System.err.println(request.getURL() +" : " + response.getStatusLine());                        String connection = response.getHeader("Connection");            if (request.getVersion().equals("HTTP/1.0") && connection != null && connection.equals("Keep-Alive")) {                System.err.println("HTTP/1.0 and connection: Keep-Alive is set");                _lastRequestTime = System.currentTimeMillis();            } else if (request.getVersion().equals("HTTP/1.1") && (connection == null || !connection.equals("Close"))) {                System.err.println("HTTP/1.1 and connection: Close is not set");                _lastRequestTime = System.currentTimeMillis();            } else {                _in = null;                _out = null;            }                        return response;        } catch (IOException ioe) {            return errorResponse(request,"IOException " + ioe);        }    }