瀏覽代碼

fix nil pointer

刘河 5 年之前
父節點
當前提交
627ea612e6
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      server/proxy/http.go

+ 2 - 2
server/proxy/http.go

@@ -171,11 +171,11 @@ reset:
 			}
 		}()
 		for {
-			if resp, err := http.ReadResponse(bufio.NewReader(connClient), r); err != nil {
+			if resp, err := http.ReadResponse(bufio.NewReader(connClient), r); err != nil || resp == nil {
 				return
 			} else {
 				//if the cache is start and the response is in the extension,store the response to the cache list
-				if s.useCache && strings.Contains(r.URL.Path, ".") {
+				if s.useCache && r.URL != nil && strings.Contains(r.URL.Path, ".") {
 					b, err := httputil.DumpResponse(resp, true)
 					if err != nil {
 						return