Merge tag 'v1.7.4' into master
This commit is contained in:
commit
d3ae88f108
154 changed files with 4356 additions and 1285 deletions
|
@ -179,7 +179,7 @@ func (l *LogHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next h
|
|||
|
||||
next.ServeHTTP(crw, reqWithDataTable)
|
||||
|
||||
core[ClientUsername] = usernameIfPresent(reqWithDataTable.URL)
|
||||
core[ClientUsername] = formatUsernameForLog(core[ClientUsername])
|
||||
|
||||
logDataTable.DownstreamResponse = crw.Header()
|
||||
|
||||
|
@ -230,14 +230,12 @@ func silentSplitHostPort(value string) (host string, port string) {
|
|||
return host, port
|
||||
}
|
||||
|
||||
func usernameIfPresent(theURL *url.URL) string {
|
||||
username := "-"
|
||||
if theURL.User != nil {
|
||||
if name := theURL.User.Username(); name != "" {
|
||||
username = name
|
||||
}
|
||||
func formatUsernameForLog(usernameField interface{}) string {
|
||||
username, ok := usernameField.(string)
|
||||
if ok && len(username) != 0 {
|
||||
return username
|
||||
}
|
||||
return username
|
||||
return "-"
|
||||
}
|
||||
|
||||
// Logging handler to log frontend name, backend name, and elapsed time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue