Dear Mark,
ok. I think I understand your problem and was able to reproduce it. The first thing that jumps out at me is that you are using BufferedWriter. The problem here is that, your output stream is buffered. I would suggest placing a call to out.flush() after writing out your "</html>" string. On my machine, this solved the problem. BufferedWriter has an internal buffer size of 8192 bytes. If you want to make sure that some of your response does not get left in this buffer, you must implicitly call flush().
So I would suggest you try a few things:
1. call flush() at the end of your writing back to the client
I tried it, it's not works. HTTP output missed or mixed and for reply small than 8192 bytes. Problems somewhere inside.
Trustin promised me reply to mail list about it soon.
2. place your response in a StringBuffer and then write the buffer to the client, along with a call to flush 3. don't use a buffered stream.
I guess problems not in BufferWriter because if I'll remove some code from sample (header's parsing part) and keep output 1024 lines only it works fine.
We need wait for Trustin's reply. Regards, Eugene Labunsky.