Fixes for non-default base_url.
authorEmil Mikulic <emikulic@gmail.com>
Sun, 15 May 2011 10:15:36 +0000 (20:15 +1000)
committerEmil Mikulic <emikulic@gmail.com>
Sat, 28 May 2011 10:10:53 +0000 (20:10 +1000)
* use relative path to graphs.xml

* use correct absolute path for hosts
  (relative paths are confused by colons in IPv6 addresses)

graph_db.c
hosts_db.c

index edba22d..6b01791 100644 (file)
@@ -345,7 +345,7 @@ html_front_page(void)
       "var graph_width = " GRAPH_WIDTH ";\n"
       "var graph_height = " GRAPH_HEIGHT ";\n"
       "var bar_gap = 1;\n"
-      "var graphs_uri = \"/graphs.xml\";\n"
+      "var graphs_uri = \"graphs.xml\";\n"
       "var graphs = [\n"
    );
 
index d3c65df..184ea91 100644 (file)
@@ -15,6 +15,7 @@
 #include "hosts_db.h"
 #include "db.h"
 #include "html.h"
+#include "http.h" /* for base_url */
 #include "ncache.h"
 #include "now.h"
 #include "str.h"
@@ -316,10 +317,10 @@ format_row_host(struct str *buf, const struct bucket *b,
 
    str_appendf(buf,
       "<tr class=\"%s\">\n"
-      " <td><a href=\"/hosts/%s/\">%s</a></td>\n"
+      " <td><a href=\"%shosts/%s/\">%s</a></td>\n"
       " <td>%s</td>\n",
       css_class,
-      ip, ip,
+      base_url, ip, ip,
       (b->u.host.dns == NULL) ? "" : b->u.host.dns);
 
    if (show_mac_addrs)