Following patch makes such config possible:

<urllist>
   <baseurl>http://www.site.com</baseurl>
   <url>/</url>
   <url>/foo.html</url>
   <url>/cgi-bin/bar.cgi</url>
</urllist>

Might be useful if you move/install your site/app around quite a lot.

I'm not sure if I got everything right (apr_pstrcat with overleaping
strings -- is it safe?), but if there are no objections I'll comit this
patch later today.

regards,
-- 
Jacek Prucia
7bulls.com S.A.
http://www.7bulls.com/


diff -urN flood.orig/config.h.in flood/config.h.in
--- flood.orig/config.h.in      2002-09-06 12:16:09.000000000 +0200
+++ flood/config.h.in   2002-09-13 14:17:31.000000000 +0200
@@ -13,6 +13,7 @@
 #define XML_URLLIST_SEQUENCE "sequence"
 #define XML_URLLIST_SEQUENCE_NAME "sequencename"
 #define XML_URLLIST_SEQUENCE_LIST "sequencelist"
+#define XML_URLLIST_BASE_URL "baseurl"
 #define XML_URLLIST_URL "url"
 #define XML_URLLIST_METHOD "method"
 #define XML_URLLIST_METHOD_GET "get"
diff -urN flood.orig/flood_round_robin.c flood/flood_round_robin.c
--- flood.orig/flood_round_robin.c      2002-09-09 11:36:01.000000000 +0200
+++ flood/flood_round_robin.c   2002-09-13 14:17:24.000000000 +0200
@@ -136,6 +136,7 @@
 
     int urls;
     url_t *url;
+    char *baseurl;
 
     cookie_t *cookie;
 
@@ -664,7 +665,7 @@
     apr_status_t rv;
     int i;
     struct apr_xml_elem *root_elem, *profile_elem,
-           *urllist_elem, *count_elem, *useurllist_elem, *e;
+           *urllist_elem, *count_elem, *useurllist_elem, *baseurl_elem, *e;
     round_robin_profile_t *p;
     char *xml_profile, *xml_urllist, *urllist_name;
 
@@ -732,6 +733,15 @@
              xml_urllist, XML_URLLIST_NAME, urllist_name)) != APR_SUCCESS)
         return rv;
 
+    /* do we have base url? */
+    if ((rv = retrieve_xml_elem_child(
+             &baseurl_elem, urllist_elem, XML_URLLIST_BASE_URL)) == 
APR_SUCCESS) {
+        /* yes we do */
+        p->baseurl = apr_pstrdup(pool, baseurl_elem->first_cdata.first->text);
+    } else {
+        p->baseurl = NULL;
+    }
+
     p->urls = 0;
     /* Include sequences.  We'll expand them later. */
     p->urls = count_xml_seq_child(urllist_elem);
@@ -828,6 +838,10 @@
 
     r->parsed_uri = apr_pcalloc(rp->pool, sizeof(apr_uri_t));
 
+    if (rp->baseurl != NULL) {
+        r->uri = apr_pstrcat(rp->pool, rp->baseurl, r->uri, NULL);
+    }
+
     apr_uri_parse(rp->pool, r->uri, r->parsed_uri);
     if (r->parsed_uri->scheme == NULL || r->parsed_uri->hostname == NULL) {
         apr_file_printf(local_stderr, "Misformed URL '%s'\n", r->uri);

Reply via email to