Skip to content

Commit

Permalink
移除响应头X-Powered-By
Browse files Browse the repository at this point in the history
  • Loading branch information
bddjr committed Jul 19, 2024
1 parent e519dab commit 4c2a10c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
5 changes: 2 additions & 3 deletions README_curl.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ curl -v -k -L http://localhost:5678/
>
< HTTP/1.1 302 Found
< Connection: close
< Date: Wed, 26 Jun 2024 01:27:58 GMT
< Date: Fri, 19 Jul 2024 05:21:42 GMT
< Location: https://localhost:5678/
< X-Powered-By: github.com/bddjr/hlfhr
< Content-Length: 0
<
* Request completely sent off
Expand All @@ -41,7 +40,7 @@ curl -v -k -L http://localhost:5678/
< Content-Length: 320
< Content-Type: text/html; charset=utf-8
< Last-Modified: Wed, 19 Jun 2024 10:52:39 GMT
< Date: Wed, 26 Jun 2024 01:27:58 GMT
< Date: Fri, 19 Jul 2024 05:21:42 GMT
<
<html>
Expand Down
16 changes: 1 addition & 15 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"net/http"
"os"
"path/filepath"
"runtime"
"time"
Expand All @@ -15,8 +14,6 @@ var srv *hlfhr.Server
var rootPath string

func main() {
getRootPath()

// Use hlfhr.New
srv = hlfhr.New(&http.Server{
Addr: ":5678",
Expand All @@ -28,25 +25,14 @@ func main() {

testPrint(srv)

err := srv.ListenAndServeTLS(
filepath.Join(rootPath, "localhost.crt"),
filepath.Join(rootPath, "localhost.key"),
)
err := srv.ListenAndServeTLS("localhost.crt", "localhost.key")
fmt.Println(err)
}

func httpResponseHandle(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, filepath.Join(rootPath, "web", r.URL.Path))
}

func getRootPath() {
ex, err := os.Executable()
if err != nil {
panic(err)
}
rootPath = filepath.Dir(ex)
}

func testPrint(srv *hlfhr.Server) {
p := "\n test:\n "
if runtime.GOOS == "windows" {
Expand Down
1 change: 0 additions & 1 deletion response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
func NewResponse() *http.Response {
h := make(http.Header)
h.Set("Date", time.Now().UTC().Format(http.TimeFormat))
h.Set("X-Powered-By", "github.com/bddjr/hlfhr")
h.Set("Connection", "close")
return &http.Response{
ProtoMajor: 1,
Expand Down

0 comments on commit 4c2a10c

Please sign in to comment.