[BUG Report] BUG/MINOR: parse: refer curproxy instead of proxy

2014-12-18 Thread Godbach

Hi Willy,

Attached is a patch for fixing a bug which should refer curproxy but 
refer proxy by mistake.


In fact, I found this issue when I was trying to change proxy list to 
double linked list for more convenient and united operation. By the way, 
is it necessary for HAProxy to make this change in latest snapshot in 
your opinion? I can send a patch when I get this work done if you will 
accept the change.


--
Best Regards,
Godbach
From c0f268d2638c0053fb470cdeda5cd70ed5cc0b96 Mon Sep 17 00:00:00 2001
From: Godbach nylzhao...@gmail.com
Date: Thu, 18 Dec 2014 15:44:58 +0800
Subject: [PATCH] BUG/MINOR: parse: refer curproxy instead of proxy

Since during parsing stage, curproxy always represents a proxy to be operated,
it should be a mistake by referring proxy.

Signed-off-by: Godbach nylzhao...@gmail.com
---
 src/cfgparse.c   | 2 +-
 src/proto_http.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cfgparse.c b/src/cfgparse.c
index c8b1546..3e345e4 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -6779,7 +6779,7 @@ out_uri_auth_compat:
curproxy-conf.args.file = curproxy-conf.uif_file;
curproxy-conf.args.line = curproxy-conf.uif_line;

parse_logformat_string(curproxy-conf.uniqueid_format_string, curproxy, 
curproxy-format_unique_id, LOG_OPT_HTTP,
-  (proxy-cap  PR_CAP_FE) ? 
SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
+  (curproxy-cap  PR_CAP_FE) ? 
SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
   curproxy-conf.uif_file, 
curproxy-conf.uif_line);
curproxy-conf.args.file = NULL;
curproxy-conf.args.line = 0;
diff --git a/src/proto_http.c b/src/proto_http.c
index 0a94785..3fffc5b 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -9691,7 +9691,7 @@ struct redirect_rule *http_parse_redirect_rule(const char 
*file, int linenum, st
 * if prefix == /, we don't want to add anything, otherwise it
 * makes it hard for the user to configure a self-redirection.
 */
-   proxy-conf.args.ctx = ARGC_RDR;
+   curproxy-conf.args.ctx = ARGC_RDR;
if (!(type == REDIRECT_TYPE_PREFIX  destination[0] == '/'  
destination[1] == '\0')) {
parse_logformat_string(destination, curproxy, 
rule-rdr_fmt, LOG_OPT_HTTP,
   (curproxy-cap  PR_CAP_FE) ? 
SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
-- 
1.7.11.7



Re: [BUG Report] BUG/MINOR: parse: refer curproxy instead of proxy

2014-12-18 Thread Willy Tarreau
Hi Godbach,

On Thu, Dec 18, 2014 at 04:20:01PM +0800, Godbach wrote:
 Hi Willy,
 
 Attached is a patch for fixing a bug which should refer curproxy but 
 refer proxy by mistake.

I think you're right. In fact this bug has no effect because during
the parsing, curproxy == proxy since it's inserted at the beginning
of the list. But better fix it anyway!

 In fact, I found this issue when I was trying to change proxy list to 
 double linked list for more convenient and united operation. By the way, 
 is it necessary for HAProxy to make this change in latest snapshot in 
 your opinion? I can send a patch when I get this work done if you will 
 accept the change.

I'm not sure, what's the purpose exactly ? I mean, double-linked lists
are fine for inserting/removing elements in the middle, but we're never
doing this, so it's not clear to me what the final goal is.

Thanks,
Willy