Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Snawoot committed Apr 14, 2020
1 parent 1984bb0 commit 1a9f547
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *ProxyHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request) {
proxyReq, err := makeConnReq(orig_req.RequestURI, s.resolver)
if err != nil {
s.logger.Error("Can't rewrite request: %v", err)
http.Error(wr, "Can't rewrite request", http.StatusInternalServerError)
http.Error(wr, "Can't rewrite request", http.StatusBadGateway)
return
}
proxyReq.Header.Set("Proxy-Authorization", s.auth())
Expand Down
7 changes: 4 additions & 3 deletions resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func (r *Resolver) ResolveAAAA(domain string) []string {
}

func (r *Resolver) Resolve(domain string) []string {
res := make([]string, 0)
res = append(res, r.ResolveA(domain)...)
res = append(res, r.ResolveAAAA(domain)...)
res := r.ResolveA(domain)
if len(res) == 0 {
res = r.ResolveAAAA(domain)
}
return res
}

0 comments on commit 1a9f547

Please sign in to comment.