Brief summary to my situation: I'm designing a new web protocol for my
university dissertation, and my experimental implementation is in Go. I
have mimicked the net/http API, since it's such a joy to use. The problem
I've encountered is in the file net/http/request.go, in the function
My problem is that if I use r.Peek(10), it returns 10 bytes as expected,
and this is the data which was sent. However, r.Buffered() returns 0 (both
before and after the call to r.Peek()), and calls to r.Read() and
r.ReadByte() block indefinitely.
I can appreciate that this has probably been caused by my wrecking the rest
of the library code, but I'm bemused at how r.Peek() can return data, while
the reader appears otherwise to contain no data.
Any ideas would be very welcome.