Go: fixing header buffer size calculation.
Header names and values are stored 0-terminated for ease of use in different
languages, so magic number 2 should be added to each name-value pair size.
@@ -63,7 +63,7 @@ func (r *response) WriteHeader(code int) {
for k, vv := range r.header {
for _, v := range vv {
fields++
- fields_size += len(k) + len(v)
+ fields_size += len(k) + len(v) + 2
}
}
