From 2ff945b9ea42489cd7d05b22df93746c66522fff Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 5 Jan 2016 14:30:05 +0200 Subject: [PATCH] Properly reset scratch buffer for header values --- header.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/header.go b/header.go index 4439241..1777feb 100644 --- a/header.go +++ b/header.go @@ -69,7 +69,7 @@ type RequestHeader struct { // SetContentRange sets 'Content-Range: bytes startPos-endPos/contentLength' // header. func (h *ResponseHeader) SetContentRange(startPos, endPos, contentLength int) { - b := h.bufKV.value + b := h.bufKV.value[:0] b = append(b, strBytes...) b = append(b, ' ') b = AppendUint(b, startPos) @@ -89,7 +89,7 @@ func (h *ResponseHeader) SetContentRange(startPos, endPos, contentLength int) { func (h *RequestHeader) SetByteRange(startPos, endPos int) { h.parseRawHeaders() - b := h.bufKV.value + b := h.bufKV.value[:0] b = append(b, strBytes...) b = append(b, '=') if startPos >= 0 { @@ -281,7 +281,7 @@ func (h *RequestHeader) SetContentTypeBytes(contentType []byte) { func (h *RequestHeader) SetMultipartFormBoundary(boundary string) { h.parseRawHeaders() - b := h.bufKV.value + b := h.bufKV.value[:0] b = append(b, strMultipartFormData...) b = append(b, ';', ' ') b = append(b, strBoundary...) @@ -298,7 +298,7 @@ func (h *RequestHeader) SetMultipartFormBoundary(boundary string) { func (h *RequestHeader) SetMultipartFormBoundaryBytes(boundary []byte) { h.parseRawHeaders() - b := h.bufKV.value + b := h.bufKV.value[:0] b = append(b, strMultipartFormData...) b = append(b, ';', ' ') b = append(b, strBoundary...)