Done. New patch attached.

--
Jeff Buchbinder
Principal Engineer / Interim Director of Infrastructure
Rave Mobile Safety, Inc
work: 508.848.2484
mobile: 860.838.3355
jbuchbin...@ravemobilesafety.com
________________________________________
From: Cyril Bonté [cyril.bo...@free.fr]
Sent: Friday, August 29, 2014 4:00 PM
To: Jeff Buchbinder
Cc: haproxy@formilux.org
Subject: Re: [PATCH] Proxied stats admin forms fix

Hi Jeff,

Le 29/08/2014 19:50, Jeff Buchbinder a écrit :
> When the haproxy stats interface is being proxied (in the case I was working 
> with, by apache's httpd), the formed absolute urls in the admin-level stats 
> console does does not work properly.

I can't remember where I identified corner cases, but that was at the
early beginning of the work on the administration forms, so maybe it
doesn't exist anymore (after some tests, I still can't find one anymore).
So it should be OK with your patch, but you'll need to update it because
it introduces a compilation warning.

> The default "action" for a form is the current URL, so it stands to reason 
> that taking the "action" parameter out of the form elements will allow these 
> forms to function as-intended in either proxied or non-proxied environments.
>
> Patch attached.

Can you update your patch to :
- remove the extra argument (scope_txt) in the first call to chunk_appendf()
- add a description directly in your patch, this will save some time to
Willy ;-)


--
Cyril Bonté
Patch for not using relative URLs for admin forms. This allows proxied instances
of the stats admin interface to continue to function, as the default FORM
action is to submit to the current URL.

Submitter: Jeff Buchbinder <jbuchbin...@ravemobilesafety.com>

diff --git a/src/dumpstats.c b/src/dumpstats.c
index 3855e09..2d3cbbe 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -3631,11 +3631,7 @@ static void stats_dump_html_px_hdr(struct stream_interface *si, struct proxy *px
 		}
 
 		chunk_appendf(&trash,
-			      "<form action=\"%s%s%s%s\" method=\"post\">",
-			      uri->uri_prefix,
-			      (appctx->ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
-			      (appctx->ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
-			      scope_txt);
+			      "<form method=\"post\">");
 	}
 
 	/* print a new table */
@@ -4139,10 +4135,7 @@ static void stats_dump_html_info(struct stream_interface *si, struct uri_auth *u
 	scope_txt[appctx->ctx.stats.scope_len] = '\0';
 
 	chunk_appendf(&trash,
-		      "<li><form method=\"GET\" action=\"%s%s%s\">Scope : <input value=\"%s\" name=\"" STAT_SCOPE_INPUT_NAME "\" size=\"8\" maxlength=\"%d\" tabindex=\"1\"/></form>\n",
-		      uri->uri_prefix,
-		      (appctx->ctx.stats.flags & STAT_HIDE_DOWN) ? ";up" : "",
-		      (appctx->ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
+		      "<li><form method=\"GET\">Scope : <input value=\"%s\" name=\"" STAT_SCOPE_INPUT_NAME "\" size=\"8\" maxlength=\"%d\" tabindex=\"1\"/></form>\n",
 		      (appctx->ctx.stats.scope_len > 0) ? scope_txt : "",
 		      STAT_SCOPE_TXT_MAXLEN);
 

Reply via email to