Browse Source

Flesh out the Life Of A Write comment

Brad Fitzpatrick 11 years ago
parent
commit
ed26b48e47
1 changed files with 6 additions and 1 deletions
  1. 6 1
      server.go

+ 6 - 1
server.go

@@ -1666,7 +1666,12 @@ func cloneHeader(h http.Header) http.Header {
 
 
 // The Life Of A Write is like this:
 // The Life Of A Write is like this:
 //
 //
-// TODO: copy/adapt the similar comment from Go's http server.go
+// * Handler calls w.Write or w.WriteString ->
+// * -> rws.bw (*bufio.Writer) ->
+// * (Handler migth call Flush)
+// * -> chunkWriter{rws}
+// * -> responseWriterState.writeChunk(p []byte)
+// * -> responseWriterState.writeChunk (most of the magic; see comment there)
 func (w *responseWriter) Write(p []byte) (n int, err error) {
 func (w *responseWriter) Write(p []byte) (n int, err error) {
 	return w.write(len(p), p, "")
 	return w.write(len(p), p, "")
 }
 }