Commit eb5eea9a authored by Stephen Ma's avatar Stephen Ma

Fix the chunked encoding - terminate the chunk with CRLF.

R=rsc
APPROVED=r
DELTA=11  (10 added, 0 deleted, 1 changed)
OCL=27723
CL=27879
parent f4b92c86
......@@ -174,7 +174,17 @@ func (c *Conn) Write(data []byte) (n int, err os.Error) {
if c.chunking {
fmt.Fprintf(c.buf, "%x\r\n", len(data)); // TODO(rsc): use strconv not fmt
}
return c.buf.Write(data);
n, err = c.buf.Write(data);
if err == nil && c.chunking {
if n != len(data) {
err = bufio.ShortWrite;
}
if err == nil {
io.WriteString(c.buf, "\r\n");
}
}
return n, err;
}
func (c *Conn) flush() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment