Releases: bddjr/hlfhr
Releases · bddjr/hlfhr
v0.2.3
go.mod 1.21 for #2 (comment)
go get github.com/bddjr/[email protected]
v0.2.2
移除响应头 X-Powered-By
go get github.com/bddjr/[email protected]
v0.2.1
适配 http.ResponseController
go get github.com/bddjr/[email protected]
v0.2.0
改用http.ReadRequest读请求,http.Handler自定义响应
go get github.com/bddjr/[email protected]
v0.2.0.pre2
允许KeepAlive,移除ErrMissingHostHeader
go get github.com/bddjr/[email protected]
// Keep Alive
srv.HttpOnHttpsPortErrorHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Connection", "keep-alive")
if srv.IdleTimeout != 0 {
w.Header().Set("Keep-Alive", fmt.Sprint("timeout=", srv.IdleTimeout.Seconds()))
}
w.WriteHeader(400)
io.WriteString(w, "Hello hlfhr")
})
v0.2.0.pre1
使用http.ReadRequest读请求,添加并使用ResponseWriter响应,完善超时机制,添加Server.NewListener,修改部分命名,优化程序
go get github.com/bddjr/[email protected]
// Check Host header
srv.HttpOnHttpsPortErrorHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.URL.Host = r.Host
switch r.URL.Hostname() {
case "localhost":
http.Redirect(w, r, "https://"+r.Host+r.URL.RequestURI(), http.StatusFound)
case "www.localhost", "127.0.0.1":
s := "https://localhost"
if port := r.URL.Port(); port != "" {
s += ":" + port
}
s += r.URL.RequestURI()
http.Redirect(w, r, s, http.StatusFound)
default:
w.WriteHeader(421)
}
})
v0.1.3
给Hlfhr_HttpOnHttpsPortErrorHandler的注释加上链接,
移除错误 "First byte does not looks like TLS handshake or HTTP request",
修复conn.Read的bug(该bug不会导致出现安全问题)
go get github.com/bddjr/[email protected]
v0.1.2
Add ReadReqMethodHostPath,
optimize read request,
add error "First byte does not looks like TLS handshake or HTTP request",
modify ScriptRedirect
go get github.com/bddjr/[email protected]
var rb []byte
method, host, path, ok := hlfhr.ReadReqMethodHostPath(rb)
v0.1.1
Public NewConn, add more option example, add ReadHostnamePort
go get github.com/bddjr/[email protected]
v0.1.0
Add Response struct, fix name
go get github.com/bddjr/[email protected]
srv.Hlfhr_HttpOnHttpsPortErrorHandler = func(rb []byte, conn net.Conn) {
resp := hlfhr.NewResponse(conn)
// 302 Found
if host, path, ok := hlfhr.ReadReqHostPath(rb); ok {
resp.Redirect(302, fmt.Sprint("https://", host, path))
return
}
// script
resp.ScriptRedirect()
}