Skip to content

Releases: bddjr/hlfhr

v0.2.3

01 Aug 14:43
74145b8
Compare
Choose a tag to compare

go.mod 1.21 for #2 (comment)

go get github.com/bddjr/[email protected]

v0.2.2

19 Jul 05:24
4c2a10c
Compare
Choose a tag to compare

移除响应头 X-Powered-By

go get github.com/bddjr/[email protected]

v0.2.1

30 Jun 04:44
e519dab
Compare
Choose a tag to compare

适配 http.ResponseController

go get github.com/bddjr/[email protected]

v0.2.0

27 Jun 07:25
adb7c87
Compare
Choose a tag to compare

改用http.ReadRequest读请求,http.Handler自定义响应

go get github.com/bddjr/[email protected]

v0.2.0.pre2

26 Jun 01:02
5a23a5d
Compare
Choose a tag to compare
v0.2.0.pre2 Pre-release
Pre-release

允许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

25 Jun 13:05
ecfc1e1
Compare
Choose a tag to compare
v0.2.0.pre1 Pre-release
Pre-release

使用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

23 Jun 10:56
5a33afa
Compare
Choose a tag to compare

给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

21 Jun 10:53
bf1690e
Compare
Choose a tag to compare

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

20 Jun 07:58
b5525ac
Compare
Choose a tag to compare

Public NewConn, add more option example, add ReadHostnamePort

go get github.com/bddjr/[email protected]

v0.1.0

19 Jun 15:05
99738dd
Compare
Choose a tag to compare

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()
}