Commented both flush methods so people know what they are looking at.
This is a necessary fix for streaming and long polling HTTP services.
Fixes #93.
R=r, rsc, david.titarenco
https://golang.org/cl/154099
}
}
-func (c *Conn) flush() {
+func (c *Conn) finishRequest() {
if !c.wroteHeader {
c.WriteHeader(StatusOK)
}
c.buf.Flush();
}
+// Flush sends any buffered data to the client.
+func (c *Conn) Flush() {
+ if !c.wroteHeader {
+ c.WriteHeader(StatusOK)
+ }
+ c.buf.Flush();
+}
+
// Close the connection.
func (c *Conn) close() {
if c.buf != nil {
if c.hijacked {
return
}
- c.flush();
+ c.finishRequest();
if c.closeAfterReply {
break
}