- defer func() {
- if statusCode == 0 {
- statusCode = w.WroteStatus()
- } else if w.WroteStatus() == 0 {
- w.WriteHeader(statusCode)
- } else if w.WroteStatus() != statusCode {
- httpserver.Log(r.RemoteAddr, "WARNING",
- fmt.Sprintf("Our status changed from %d to %d after we sent headers", w.WroteStatus(), statusCode))
- }
- if statusText == "" {
- statusText = http.StatusText(statusCode)
- }
- httpserver.Log(remoteAddr, statusCode, statusText, w.WroteBodyBytes(), r.Method, r.Host, r.URL.Path, r.URL.RawQuery)
- }()