Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2353)

Issue 4239076: code review 4239076: http: change ResponseWriter.SetHeader(k,v) to Header() ... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 9 months ago by bradfitz
Modified:
13 years, 9 months ago
Reviewers:
CC:
rsc, gburd, golang-dev
Visibility:
Public.

Description

http: change ResponseWriter.SetHeader(k,v) to Header() accessor Caller code needs to change: rw.SetHeader("Content-Type", "text/plain") to: rw.Header().Set("Content-Type", "text/plain") This now permits returning multiple headers with the same name using Add: rw.Header().Add("Set-Cookie", "..") rw.Header().Add("Set-Cookie", "..") This patch also fixes serialization of headers, removing newline characters. Fixes issue 488 Fixes Issue 914

Patch Set 1 #

Patch Set 2 : diff -r a5f4ae5ff5fa https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r a5f4ae5ff5fa https://go.googlecode.com/hg/ #

Total comments: 14

Patch Set 4 : diff -r a5f4ae5ff5fa https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r a5f4ae5ff5fa https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+107 lines, -110 lines) Patch
M src/cmd/godoc/godoc.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/godoc/main.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/expvar/expvar.go View 1 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/http/cgi/child.go View 1 1 chunk +2 lines, -6 lines 0 comments Download
M src/pkg/http/cgi/host.go View 1 2 chunks +2 lines, -5 lines 0 comments Download
M src/pkg/http/cgi/host_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/http/cgi/matryoshka_test.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/http/fs.go View 1 3 chunks +7 lines, -7 lines 0 comments Download
M src/pkg/http/httptest/recorder.go View 1 2 3 4 3 chunks +9 lines, -16 lines 0 comments Download
M src/pkg/http/pprof/pprof.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/http/response.go View 1 2 3 1 chunk +4 lines, -1 line 0 comments Download
M src/pkg/http/responsewrite_test.go View 1 2 3 2 chunks +24 lines, -1 line 0 comments Download
M src/pkg/http/serve_test.go View 1 4 chunks +5 lines, -5 lines 0 comments Download
M src/pkg/http/server.go View 1 2 3 16 chunks +40 lines, -55 lines 0 comments Download
M src/pkg/http/triv.go View 1 2 chunks +2 lines, -2 lines 0 comments Download
M src/pkg/rpc/server.go View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6
bradfitz
Hello rsc (cc: gburd, golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 9 months ago (2011-03-09 16:50:02 UTC) #1
bradfitz
Hello rsc (cc: gburd, golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2011-03-09 16:57:34 UTC) #2
rsc
LGTM Assuming that it is responsewrite_test.go that is wrong. http://codereview.appspot.com/4239076/diff/6001/src/pkg/http/cgi/host.go File src/pkg/http/cgi/host.go (right): http://codereview.appspot.com/4239076/diff/6001/src/pkg/http/cgi/host.go#newcode171 src/pkg/http/cgi/host.go:171: ...
13 years, 9 months ago (2011-03-09 17:09:27 UTC) #3
bradfitz
Hello rsc (cc: gburd, golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2011-03-09 17:36:02 UTC) #4
bradfitz
I also removed some duplicate code and now call writeSortedHeader() which is where I actually ...
13 years, 9 months ago (2011-03-09 17:37:53 UTC) #5
bradfitz
13 years, 9 months ago (2011-03-09 17:41:10 UTC) #6
*** Submitted as http://code.google.com/p/go/source/detail?r=9da4e71e8f1b ***

http: change ResponseWriter.SetHeader(k,v) to Header() accessor

Caller code needs to change:

rw.SetHeader("Content-Type", "text/plain")
to:
rw.Header().Set("Content-Type", "text/plain")

This now permits returning multiple headers
with the same name using Add:

rw.Header().Add("Set-Cookie", "..")
rw.Header().Add("Set-Cookie", "..")

This patch also fixes serialization of headers, removing newline characters.

Fixes issue 488
Fixes Issue 914

R=rsc
CC=gburd, golang-dev
http://codereview.appspot.com/4239076
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b