diff --git a/cmd/http-tracer.go b/cmd/http-tracer.go index b728dfa8d..186108a43 100644 --- a/cmd/http-tracer.go +++ b/cmd/http-tracer.go @@ -30,11 +30,9 @@ import ( "strings" "time" - "github.com/gorilla/mux" "github.com/minio/madmin-go" "github.com/minio/minio/internal/handlers" "github.com/minio/minio/internal/logger" - jsonrpc "github.com/minio/rpc" ) // recordRequest - records the first recLen bytes @@ -110,75 +108,6 @@ func getOpName(name string) (op string) { return op } -// WebTrace gets trace of web request -func WebTrace(ri *jsonrpc.RequestInfo) madmin.TraceInfo { - r := ri.Request - w := ri.ResponseWriter - - name := ri.Method - // Setup a http request body recorder - reqHeaders := r.Header.Clone() - reqHeaders.Set("Host", r.Host) - if len(r.TransferEncoding) == 0 { - reqHeaders.Set("Content-Length", strconv.Itoa(int(r.ContentLength))) - } else { - reqHeaders.Set("Transfer-Encoding", strings.Join(r.TransferEncoding, ",")) - } - - now := time.Now().UTC() - t := madmin.TraceInfo{TraceType: madmin.TraceHTTP, FuncName: name, Time: now} - t.NodeName = r.Host - if globalIsDistErasure { - t.NodeName = globalLocalNodeName - } - if t.NodeName == "" { - t.NodeName = globalLocalNodeName - } - - // strip only standard port from the host address - if host, port, err := net.SplitHostPort(t.NodeName); err == nil { - if port == "443" || port == "80" { - t.NodeName = host - } - } - - vars := mux.Vars(r) - rq := madmin.TraceRequestInfo{ - Time: now, - Proto: r.Proto, - Method: r.Method, - Path: SlashSeparator + pathJoin(vars["bucket"], vars["object"]), - RawQuery: redactLDAPPwd(r.URL.RawQuery), - Client: handlers.GetSourceIP(r), - Headers: reqHeaders, - } - - rw, ok := w.(*logger.ResponseWriter) - if ok { - rs := madmin.TraceResponseInfo{ - Time: time.Now().UTC(), - Headers: rw.Header().Clone(), - StatusCode: rw.StatusCode, - Body: logger.BodyPlaceHolder, - } - - if rs.StatusCode == 0 { - rs.StatusCode = http.StatusOK - } - - t.RespInfo = rs - t.CallStats = madmin.TraceCallStats{ - Latency: rs.Time.Sub(rw.StartTime), - InputBytes: int(r.ContentLength), - OutputBytes: rw.Size(), - TimeToFirstByte: rw.TimeToFirstByte, - } - } - - t.ReqInfo = rq - return t -} - // Trace gets trace of http request func Trace(f http.HandlerFunc, logBody bool, w http.ResponseWriter, r *http.Request) madmin.TraceInfo { name := getOpName(runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()) diff --git a/cmd/server-startup-msg.go b/cmd/server-startup-msg.go index f2858e5e5..6cb218e60 100644 --- a/cmd/server-startup-msg.go +++ b/cmd/server-startup-msg.go @@ -96,6 +96,11 @@ func isNotIPv4(host string) bool { // port "80" and "443" before displaying on the startup // banner. Returns a new list of API endpoints. func stripStandardPorts(apiEndpoints []string, host string) (newAPIEndpoints []string) { + if len(apiEndpoints) == 1 && globalBrowserRedirectURL != nil { + if apiEndpoints[0] == globalBrowserRedirectURL.String() { + return []string{globalBrowserRedirectURL.String()} + } + } newAPIEndpoints = make([]string, len(apiEndpoints)) // Check all API endpoints for standard ports and strip them. for i, apiEndpoint := range apiEndpoints { diff --git a/go.mod b/go.mod index 1c598cafa..f19cf36bd 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,6 @@ require ( github.com/minio/minio-go/v7 v7.0.13-0.20210715203016-9e713532886e github.com/minio/parquet-go v1.0.0 github.com/minio/pkg v1.0.10 - github.com/minio/rpc v1.0.0 github.com/minio/selfupdate v0.3.1 github.com/minio/sha256-simd v1.0.0 github.com/minio/simdjson-go v0.2.1 diff --git a/go.sum b/go.sum index 79a99530a..3664e30c5 100644 --- a/go.sum +++ b/go.sum @@ -1044,8 +1044,6 @@ github.com/minio/pkg v1.0.4/go.mod h1:obU54TZ9QlMv0TRaDgQ/JTzf11ZSXxnSfLrm4tMtBP github.com/minio/pkg v1.0.8/go.mod h1:32x/3OmGB0EOi1N+3ggnp+B5VFkSBBB9svPMVfpnf14= github.com/minio/pkg v1.0.10 h1:fohpAm/0ttQFf4BzmzH5r6A9JUIfg63AyGCPM0f9/9U= github.com/minio/pkg v1.0.10/go.mod h1:32x/3OmGB0EOi1N+3ggnp+B5VFkSBBB9svPMVfpnf14= -github.com/minio/rpc v1.0.0 h1:tJCHyLfQF6k6HlMQFpKy2FO/7lc2WP8gLDGMZp18E70= -github.com/minio/rpc v1.0.0/go.mod h1:b9xqF7J0xeMXr0cM4pnBlP7Te7PDsG5JrRxl5dG6Ldk= github.com/minio/selfupdate v0.3.1 h1:BWEFSNnrZVMUWXbXIgLDNDjbejkmpAmZvy/nCz1HlEs= github.com/minio/selfupdate v0.3.1/go.mod h1:b8ThJzzH7u2MkF6PcIra7KaXO9Khf6alWPvMSyTDCFM= github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=