mirror of
https://github.com/golang/go
synced 2024-11-26 01:07:57 -07:00
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
This commit is contained in:
parent
f4b92c8624
commit
eb5eea9a8f
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user