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

Comments

Projects
None yet
8 participants
@HouzuoGuo
Copy link

commented Nov 13, 2015

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

This comment has been minimized.

Copy link
Member

commented Nov 13, 2015

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

This comment has been minimized.

Copy link

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 label Oct 10, 2016

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

@odeke-em

This comment has been minimized.

Copy link
Member

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 removed their assignment Feb 8, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Mar 13, 2017

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

@niklas88

This comment has been minimized.

Copy link
Contributor

commented May 18, 2017

@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

This comment has been minimized.

Copy link
Member

commented May 18, 2017

@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

This comment has been minimized.

Copy link
Contributor

commented May 22, 2017

@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

This comment has been minimized.

Copy link
Member

commented May 23, 2017

@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

This comment has been minimized.

Copy link

commented May 24, 2017

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

@niklas88

This comment has been minimized.

Copy link
Contributor

commented May 24, 2017

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 gopherbot closed this in 0b77d3e Jun 8, 2017

gopherbot pushed a commit that referenced this issue Jun 8, 2017

net/http: simplify recently added TestServeTLS
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.
You can’t perform that action at this time.