Handle case where no auth is sent to rpcserver.
This commit is contained in:
parent
fd0679acdd
commit
35c95f0a36
1 changed files with 2 additions and 1 deletions
|
@ -45,7 +45,8 @@ func (s *rpcServer) Start() {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
login := s.username + ":" + s.password
|
login := s.username + ":" + s.password
|
||||||
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
|
auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
|
||||||
if r.Header["Authorization"][0] == auth {
|
authhdr := r.Header["Authorization"]
|
||||||
|
if len(authhdr) > 0 && authhdr[0] == auth {
|
||||||
jsonRPCRead(w, r, s)
|
jsonRPCRead(w, r, s)
|
||||||
} else {
|
} else {
|
||||||
log.Warnf("[RPCS] Auth failure.")
|
log.Warnf("[RPCS] Auth failure.")
|
||||||
|
|
Loading…
Add table
Reference in a new issue