jacekp 2002/09/16 02:55:07
Modified: flood config.h.in flood_round_robin.c
Log:
Added baseurl tag to urllist. Following config:
<urllist>
<baseurl>http://www.site.com</baseurl>
<url>/</url>
<url>/foo.html</url>
<url>/cgi-bin/bar.cgi</url>
</urllist>
...hits those URLs:
http://www.site.com/
http://www.site.com/foo.html
http://www.site.com/cgi-bin/bar.cgi
Usefull when dealing with site/app that gets moved around a lot.
Revision Changes Path
1.25 +1 -0 httpd-test/flood/config.h.in
Index: config.h.in
===================================================================
RCS file: /home/cvs/httpd-test/flood/config.h.in,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- config.h.in 6 Sep 2002 10:16:09 -0000 1.24
+++ config.h.in 16 Sep 2002 09:55:07 -0000 1.25
@@ -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"
1.32 +15 -1 httpd-test/flood/flood_round_robin.c
Index: flood_round_robin.c
===================================================================
RCS file: /home/cvs/httpd-test/flood/flood_round_robin.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- flood_round_robin.c 9 Sep 2002 09:36:01 -0000 1.31
+++ flood_round_robin.c 16 Sep 2002 09:55:07 -0000 1.32
@@ -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);
@@ -827,6 +837,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) {