Skip to content
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: Please offer function "ServeTLS" #13228

Closed
HouzuoGuo opened this issue Nov 13, 2015 · 10 comments
Closed

net/http: Please offer function "ServeTLS" #13228

HouzuoGuo opened this issue Nov 13, 2015 · 10 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@HouzuoGuo
Copy link

In package net/http, there's a pair of Listen* functions: ListenAndServe, ListenAndServeTLS.

It would be incredibly helpful to offer both Serve and ServeTLS as well.

@bradfitz bradfitz added this to the Unplanned milestone Nov 13, 2015
@bradfitz
Copy link
Contributor

Serve already exists:
https://golang.org/pkg/net/http/#Server.Serve

We may do something more in Go 1.7, especially in light of LetsEncrypt, making that a bit easier. We'll see.

@Gurpartap
Copy link

Gurpartap commented Jul 3, 2016

I had to serve (with TLS) on systemd provided fds listener (socket activation).

Here's a Server.ServeTLS I put together from existing code in Server.ListenAndServeTLS:
Gurpartap/go@31135bf

Tested to work with systemd socket listening on 443 and using ServeTLS with listener provided by https://github.com/coreos/go-systemd/tree/master/activation

(If it matters, I'm using this with LetsEncrypt provided cert/key in my project, not that the function's exclusively for this purpose)

@bradfitz bradfitz modified the milestones: Go1.8Maybe, Unplanned Jul 3, 2016
@bradfitz bradfitz self-assigned this Jul 3, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 20, 2016
@odeke-em
Copy link
Member

odeke-em commented Feb 5, 2017

@Gurpartap are you interested in making that a patch that's code reviewable on Gerrit since we
can't review patches here?

@bradfitz bradfitz added help wanted Suggested Issues that may be good for new contributors looking for work to do. labels Feb 8, 2017
@bradfitz bradfitz removed their assignment Feb 8, 2017
@gopherbot
Copy link

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

@niklas88
Copy link
Contributor

@bradfitz I haven't seen any changes or comments to address your comments from March, is there some way I can help and take over this CL? This would be very helpful for my home automation project which uses systemd socket activation. If this doesn't make it into 1.9 I'll have to resort to a much uglier custom copy of this code.

@bradfitz
Copy link
Contributor

@niklas88, sure, feel free to take it over.

I left new comments on https://go-review.googlesource.com/c/38114/ so be sure to incorporate those too.

@niklas88
Copy link
Contributor

@bradfitz ok, so I have incorporated your comments and added a test. However I don't know how to mail this since it will then also contain the original change by @Gurpartap and git codereview doesn't let me mail changes with another author. I added commits on top of his change only to keep his authorship intact (by using the download copy paste from gerrit). Any idea how to best resolve this? It's my first time using gerrit...

@bradfitz
Copy link
Contributor

@niklas88, just send a change in a single commit that's a copy of his under your own git Author name. You can give @Gurpartap credit in your commit message and reference his original Gerrit URL.

@gopherbot
Copy link

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

@niklas88
Copy link
Contributor

Ok thanks for that tip, I'm not sure I've done this right as I ended up with two reviews instead of a combined one as it wouldn't let me mail it with the existing Change-Id but here it is:

gopherbot pushed a commit that referenced this issue Jun 8, 2017
TestServeTLS was added in CL 44074, merged today.
This cleans up the test a little.

Updates #13228

Change-Id: I6efd798fe5fa015a34addbf60ae26919a1ed283e
Reviewed-on: https://go-review.googlesource.com/45152
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@golang golang locked and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

8 participants