So, while you are waiting for the browser to close the stream, maybe it is waiting for you to say some HTTP to it.
Dev Brown wrote:
Here's a code snippet:
Note: "in" is a BufferedReader reading an HTTP request from a browser via a socket. "HeaderElements" is a HashMap.
int colonIndex = 0; boolean initialLine = true; String currentLine; try { while((currentLine = in.readLine()) != null){ if(initialLine){//special case parseInitialRequestLine(currentLine); initialLine = false; } else{ if((colonIndex = currentLine.indexOf(":")) != -1){ headerElements.put(currentLine.substring(0, colonIndex), currentLine.substring(colonIndex+2));//the key, value
} }//end else }//end while }
My problem is this: the readLine method hangs. All the header lines are received and stored fine but readLine() never returns. Looking into it, one book (old, from 1999) I read said this is a bug in the readLine() method and that the problem is that it is looking for "\r\n" but apparently is only getting "\r" when reading over the network. Does anyone know if this really is still a bug or am I doing something wrong? If the former, what workaround would you suggest, read() character?
Thanks, Dev
_______________________________________________ Juglist mailing list [EMAIL PROTECTED] http://trijug.org/mailman/listinfo/juglist_trijug.org
