server: set requestID for each request
This commit is contained in:
parent
14f068eddb
commit
9b21edfbce
|
@ -12,6 +12,7 @@ import (
|
|||
"net/rpc"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.xeserv.us/xena/route/database"
|
||||
|
@ -143,7 +144,15 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
r.Header.Set("X-Remote-IP", host)
|
||||
r.Header.Set("X-Request-Ingress", time.Now().String())
|
||||
|
||||
if r.RequestURI == rpc.DefaultRPCPath && r.Host == "" {
|
||||
rid := uuid.New()
|
||||
r.Header.Set("X-Request-Id", rid)
|
||||
w.Header().Set("X-Request-Id", rid)
|
||||
|
||||
if strings.HasSuffix(r.Host, ".onion") {
|
||||
w.Header().Add("DNT", "1")
|
||||
}
|
||||
|
||||
if r.RequestURI == rpc.DefaultRPCPath {
|
||||
s.rpcS.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue