You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Johan Bergström <jo...@bergstroem.nu> on 2006/06/23 09:07:27 UTC

Jk_status doesn't generate valid html (patch included)

Hello dev-list.
I'm quite new to both tomcat and mod_jk.. really liking it so far!  
Thought I could contribute back with some minor things I found.

Jk_status throws out some garbled html;

  * Ampersands (&) are not escaped
  * Input hiddens are wrapped in a table (?)
  * Superfluous td/tr/table and invalid closures scattered throughout  
the file.
  and
  * (Tabbed in an comment to follow guidelines)

Maybe i missed something (like a reason why they should be there) but  
here's an proposed diff:

(have a nice weekend)


Index: jk/native/common/jk_status.c
===================================================================
--- jk/native/common/jk_status.c	(revision 416584)
+++ jk/native/common/jk_status.c	(working copy)
@@ -432,7 +432,7 @@
              jk_putv(s, "<a href=\"", s->req_uri, "?cmd=show\">",  
NULL);
          }
          else
-            jk_putv(s, "<a href=\"", s->req_uri, "?cmd=show&w=",
+            jk_putv(s, "<a href=\"", s->req_uri, "?cmd=show&amp;w=",
                      sw->we->worker_list[i], "\">", NULL);
          jk_putv(s, sw->we->worker_list[i], "</a></h3>\n", NULL);
          if (lb != NULL) {
@@ -462,7 +462,7 @@
                  worker_record_t *wr = &(lb->lb_workers[j]);
                  ajp_worker_t *a = (ajp_worker_t *)wr->w- 
 >worker_private;
                  jk_putv(s, "<tr>\n<td><a href=\"", s->req_uri,
-                        "?cmd=show&w=",
+                        "?cmd=show&amp;w=",
                          wr->s->name, "\">",
                          wr->s->name, "</a></td>", NULL);
                  if (dworker && strcmp(dworker, wr->s->name) == 0)
@@ -511,19 +511,19 @@
                          wr->s->jvm_route, ")</h3>\n", NULL);
                  jk_putv(s, "<form method=\"GET\" action=\"",
                          s->req_uri, "\">\n", NULL);
-                jk_puts(s, "<table>\n<input type=\"hidden\" name= 
\"cmd\" ");
+                jk_puts(s, "<input type=\"hidden\" name=\"cmd\" ");
                  jk_puts(s, "value=\"update\">\n");
                  jk_puts(s, "<input type=\"hidden\" name=\"w\" ");
                  jk_putv(s, "value=\"", wr->s->name, "\">\n", NULL);
                  jk_puts(s, "<input type=\"hidden\" name=\"id\" ");
-                jk_printf(s, "value=\"%u\">\n</table>\n", selected);
+                jk_printf(s, "value=\"%u\">\n", selected);
                  jk_puts(s, "<input type=\"hidden\" name=\"lb\" ");
-                jk_printf(s, "value=\"%u\">\n</table>\n", i);
+                jk_printf(s, "value=\"%u\">", i);
                  jk_puts(s, "<table>\n<tr><td>Distance:</ 
td><td><input name=\"wx\" type=\"text\" ");
                  jk_printf(s, "value=\"%d\"/></td><tr>\n", wr->s- 
 >distance);
                  jk_puts(s, "<tr><td>Load factor:</td><td><input  
name=\"wf\" type=\"text\" ");
-                jk_printf(s, "value=\"%d\"/></td><tr>\n", wr->s- 
 >lb_factor);
+                jk_printf(s, "value=\"%d\"/></td></tr>\n", wr->s- 
 >lb_factor);
                  jk_puts(s, "<tr><td>Route Redirect:</td><td><input  
name=\"wr\" type=\"text\" ");
                  jk_putv(s, "value=\"", wr->s->redirect, NULL);
                  jk_puts(s, "\"/></td></tr>\n");
@@ -537,7 +537,7 @@
                  jk_puts(s, "<tr><td>Stopped:</td><td><input name= 
\"ws\" type=\"checkbox\"");
                  if (wr->s->is_stopped)
                      jk_puts(s, "  checked=\"checked\"");
-                jk_puts(s, "/></td></tr>\n");
+                jk_puts(s, "/>\n");
                  jk_puts(s, "</td></tr>\n</table>\n");
                  jk_puts(s, "<br/><input type=\"submit\" value= 
\"Update Worker\"/>\n</form>\n");
@@ -782,7 +782,7 @@
          i = status_int("wf", s->query_string, wr->s->lb_factor);
          if (i > 0 && wr->s->lb_factor != i) {
              wr->s->lb_factor = i;
-/* Recalculate the load multiplicators wrt. lb_factor */
+            /* Recalculate the load multiplicators wrt. lb_factor */
              update_mult(lb, l);
          }
      }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Jk_status doesn't generate valid html (patch included)

Posted by Rainer Jung <ra...@kippdata.de>.
Thanks, I committed most of it (and some more). The only thing I left 
unchanged is not escaping the Ampersand as a seperator between query 
arguments.

Johan Bergström schrieb:
> Hello dev-list.
> I'm quite new to both tomcat and mod_jk.. really liking it so far! 
> Thought I could contribute back with some minor things I found.
>
> Jk_status throws out some garbled html;
>
>  * Ampersands (&) are not escaped
>  * Input hiddens are wrapped in a table (?)
>  * Superfluous td/tr/table and invalid closures scattered throughout 
> the file.
>  and
>  * (Tabbed in an comment to follow guidelines)
>
> Maybe i missed something (like a reason why they should be there) but 
> here's an proposed diff:
>
> (have a nice weekend)
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org