Skip to content

Commit

Permalink
Fix metadata server to only serve hypervisor VMs for all requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rgooch committed Dec 9, 2018
1 parent 566ccd5 commit 0e95717
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hypervisor/metadatad/httpHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
}
ipAddr := net.ParseIP(hostname)
s.manager.NotifyVmMetadataRequest(ipAddr, req.URL.Path)
if rawHandler, ok := s.rawHandlers[req.URL.Path]; ok {
rawHandler(w, ipAddr)
return
}
vmInfo, err := s.manager.GetVmInfo(ipAddr)
if err != nil {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.WriteHeader(http.StatusNotFound)
return
}
if rawHandler, ok := s.rawHandlers[req.URL.Path]; ok {
rawHandler(w, ipAddr)
return
}
writer := bufio.NewWriter(w)
defer writer.Flush()
if infoHandler, ok := s.infoHandlers[req.URL.Path]; ok {
Expand Down

0 comments on commit 0e95717

Please sign in to comment.