1
0

Use X-Real-IP to get client addr.

This commit is contained in:
Alexander Andreev 2022-02-11 04:30:37 +04:00
parent f3aade2b9f
commit 8cc669be1c
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -181,7 +181,7 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
netTyp, _ := utils.NetworkType(r.Host) netTyp, _ := utils.NetworkType(r.Host)
h.logUpload.Printf("| %s | %s | %s | SHA256 %s | %s | %d | %s", r.RemoteAddr, netTyp, h.logUpload.Printf("| %s | %s | %s | SHA256 %s | %s | %d | %s", r.Header.Get("X-Real-IP"), netTyp,
fHandler.Filename, fSha256, fSaltedHash, fHandler.Size, r.UserAgent()) fHandler.Filename, fSha256, fSaltedHash, fHandler.Size, r.UserAgent())
w.WriteHeader(http.StatusCreated) w.WriteHeader(http.StatusCreated)
@ -234,7 +234,7 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
netTyp, _ := utils.NetworkType(r.Host) netTyp, _ := utils.NetworkType(r.Host)
h.logDownload.Printf("| %s | %s | %s | %s | %s", r.RemoteAddr, netTyp, name, saltedHash, r.UserAgent()) h.logDownload.Printf("| %s | %s | %s | %s | %s", r.Header.Get("X-Real-IP"), netTyp, name, saltedHash, r.UserAgent())
http.ServeContent(w, r, path, stat.ModTime(), fd) http.ServeContent(w, r, path, stat.ModTime(), fd)
} }