Improved performance
This commit is contained in:
11
Server.go
11
Server.go
@ -216,7 +216,16 @@ func (s *server) handleRequest(ctx *context, method string, url string, writer i
|
||||
tmp.WriteString(strconv.Itoa(int(ctx.status)))
|
||||
tmp.WriteString("\r\nContent-Length: ")
|
||||
tmp.WriteString(strconv.Itoa(len(ctx.response.body)))
|
||||
tmp.WriteString("\r\n\r\n")
|
||||
tmp.WriteString("\r\n")
|
||||
|
||||
for _, header := range ctx.response.headers {
|
||||
tmp.WriteString(header.Key)
|
||||
tmp.WriteString(": ")
|
||||
tmp.WriteString(header.Value)
|
||||
tmp.WriteString("\r\n")
|
||||
}
|
||||
|
||||
tmp.WriteString("\r\n")
|
||||
tmp.Write(ctx.response.body)
|
||||
writer.Write(tmp.Bytes())
|
||||
}
|
||||
|
Reference in New Issue
Block a user