问题描述
有没有人在 beego 中成功实现 h2c(HTTP/2 纯文本)协议作为服务器?
我尝试使用这种方法使用来自 golang.org/x/net/http2 包的 http/2 https://beego.me/docs/mvc/controller/router.md#handler-register
我是这样实现的
h2server := &http2.Server{}
handler := http.HandlerFunc(func(w http.ResponseWriter,r *http.Request) {
_,_ = fmt.Fprintf(w,"Hello,%v,http: %v",r.URL.Path,r.TLS == nil)
})
server := &http.Server{
Addr: "0.0.0.0:" + strconv.Itoa(beego.BConfig.Listen.HTTPPort),Handler: h2c.NewHandler(handler,h2server),}
但是我所有的 beego.router 都必须移动到处理程序中。
还有其他更好的方法吗?
谢谢
FEF
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)