瀏覽代碼

core: tcp - allow plain connections when tcp_accept_haproxy=yes

- PR #2206
iurri 5 年之前
父節點
當前提交
a4d78bb011
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      src/core/tcp_main.c

+ 5 - 4
src/core/tcp_main.c

@@ -1107,10 +1107,9 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {
 		}
 		}
 	} else if (bytes == 0) {
 	} else if (bytes == 0) {
 		return 1; /* EOF? Return "no IP change" in any case */
 		return 1; /* EOF? Return "no IP change" in any case */
-	}
-	else {
-		/* Wrong protocol */
-		return -1;
+	} else {
+		/* not haproxy protocol */
+		return 2;
 	}
 	}
 
 
 done:
 done:
@@ -1167,6 +1166,8 @@ struct tcp_connection* tcpconn_new(int sock, union sockaddr_union* su,
 			goto error;
 			goto error;
 		} else if (ret == 1) {
 		} else if (ret == 1) {
 			LM_DBG("PROXY protocol did not override IP addresses\n");
 			LM_DBG("PROXY protocol did not override IP addresses\n");
+		} else if (ret == 2) {
+			LM_DBG("PROXY protocol header not found\n");
 		}
 		}
 	}
 	}
 	print_ip("tcpconn_new: new tcp connection: ", &c->rcv.src_ip, "\n");
 	print_ip("tcpconn_new: new tcp connection: ", &c->rcv.src_ip, "\n");