New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http, net/textproto: Move net/http.Header.Write() to net/textproto.MIMEHeader.Write() #16479

Open
emersion opened this Issue Jul 23, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@emersion

emersion commented Jul 23, 2016

http.Header is using many methods from textproto.MIMEHeader (see https://golang.org/src/net/http/header.go), but textproto.MIMEHeader is missing a Write method. This method is implemented in net/http. It seems weird to import net/http each time a textproto.MIMEHeader needs to be formatted. The Write method could instead be moved to net/textproto, and called in net/http as it's done for several other functions.

@quentinmit quentinmit changed the title from Move net/http.Header.Write() to net/textproto.MIMEHeader.Write() to net/http, net/textproto: Move net/http.Header.Write() to net/textproto.MIMEHeader.Write() Jul 29, 2016

@quentinmit quentinmit added this to the Go1.8Maybe milestone Jul 29, 2016

@quentinmit

This comment has been minimized.

Contributor

quentinmit commented Jul 29, 2016

For backwards-compatibility reasons we'll have to keep around a Header.Write, of course.

@gopherbot

This comment has been minimized.

gopherbot commented Jul 31, 2016

CL https://golang.org/cl/25341 mentions this issue.

@quentinmit quentinmit added the NeedsFix label Oct 10, 2016

@bradfitz

This comment has been minimized.

Member

bradfitz commented Oct 12, 2016

Copy of comment from CL:

Do we really want to add a WriteSubset method to the textproto package? It's weird enough in net/http in retrospect. If textproto needs this functionality, then I'd rather move the bulk of the logic to an internal shared package so we don't need to expose WriteSubset.

@emersion

This comment has been minimized.

emersion commented Oct 12, 2016

So the idea would be to add WriteSubset to net/internal?

Another solution would be to implement Write without WriteSubset in textproto, and keep the WriteSubset implementation in http.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Oct 12, 2016

As long as we don't add more public API.

@rsc

This comment has been minimized.

Contributor

rsc commented Oct 20, 2016

Let's leave things alone for Go 1.8.

@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 20, 2016

@bradfitz bradfitz modified the milestones: Go1.10, Go1.9 Jun 5, 2017

@bradfitz bradfitz modified the milestones: Go1.10, Unplanned Nov 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment