Reading request content from Java socket InputStream, always hangs after header

Viewed 12385

I am trying to use core Java to read HTTP request data from an inputstream, using the following code:

BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();

I receive the header fine, but then the client just hangs forever because the server never finds "EOF" of the request. How do I handle this? I've seen this question asked quite a bit, and most solutions involve something like the above, however it's not working for me. I've tried using both curl and a web browser as the client, just sending a get request

Thanks for any ideas

2 Answers
Related