Просмотр исходного кода

Fix handling of comma-separated Forwarded-For headers

Rod Hynes 3 лет назад
Родитель
Сommit
3b2cfbcaf6
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      psiphon/server/meek.go

+ 3 - 0
psiphon/server/meek.go

@@ -674,6 +674,9 @@ func (server *MeekServer) getSessionOrEndpoint(
 				IPs := strings.Split(value, ",")
 				IPs := strings.Split(value, ",")
 				IP := IPs[len(IPs)-1]
 				IP := IPs[len(IPs)-1]
 
 
+				// Remove optional whitespace surrounding the commas.
+				IP = strings.TrimSpace(IP)
+
 				if net.ParseIP(IP) != nil {
 				if net.ParseIP(IP) != nil {
 					clientIP = IP
 					clientIP = IP
 					break
 					break