in flood_round_robin.c [612:706]
static apr_status_t parse_xml_seq_info(apr_xml_elem *e,
round_robin_profile_t *p,
apr_pool_t *pool)
{
char *seqname, **seqlist;
int seqnamelen, seqcount, curseq;
struct apr_xml_elem *child_url_elem;
apr_status_t rv;
if (e->attr) {
apr_xml_attr *attr = e->attr;
while (attr) {
if (strncasecmp(attr->name, XML_URLLIST_SEQUENCE_NAME,
FLOOD_STRLEN_MAX) == 0) {
seqname = (char*)attr->value;
seqnamelen = strlen(seqname);
}
else if (strncasecmp(attr->name,
XML_URLLIST_SEQUENCE_LIST,
FLOOD_STRLEN_MAX) == 0) {
/* FIXME: ap_getword needs to be in apr-util! */
char *end, *cur;
int count = 1, num = 0;
end = (char*)attr->value;
while (*end && (end = strchr(end, ','))) {
count++;
end++;
}
seqlist = apr_palloc(pool, sizeof(char*) * count);
seqcount = count;
cur = (char*)attr->value;
end = strchr(cur, ',');
for (num = 0; num < count; num++) {
while (apr_isspace(*cur)) {
cur++;
}
if (end) {
seqlist[num] = apr_pstrmemdup(pool, cur,
end - cur);
cur = ++end;
end = strchr(cur, ',');
}
else {
seqlist[num] = apr_pstrdup(pool, cur);
}
}
}
attr = attr->next;
}
}
for (curseq = 0; curseq < seqcount; curseq++) {
apr_hash_set(p->state, seqname, seqnamelen, seqlist[curseq]);
for (child_url_elem = e->first_child; child_url_elem;
child_url_elem = child_url_elem->next) {
if (strncasecmp(child_url_elem->name, XML_URLLIST_SEQUENCE,
FLOOD_STRLEN_MAX) == 0) {
rv = parse_xml_seq_info(child_url_elem, p, pool);
if (rv != APR_SUCCESS) {
return rv;
}
}
else if (strncasecmp(child_url_elem->name, XML_URLLIST_URL,
FLOOD_STRLEN_MAX) == 0) {
rv = parse_xml_url_info(child_url_elem,
&p->url[p->current_url],
pool);
if (rv != APR_SUCCESS) {
return rv;
}
/* Expand them. */
if (p->url[p->current_url].payloadtemplate) {
p->url[p->current_url].payloadtemplate =
handle_param_string(p,
p->url[p->current_url].payloadtemplate,
EPE_PASSTHROUGH);
}
if (p->url[p->current_url].requesttemplate) {
p->url[p->current_url].requesttemplate =
handle_param_string(p,
p->url[p->current_url].requesttemplate,
EPE_PASSTHROUGH);
}
if (p->url[p->current_url].responsetemplate) {
p->url[p->current_url].responsetemplate =
handle_param_string(p,
p->url[p->current_url].responsetemplate,
EPE_PASSTHROUGH);
}
p->current_url++;
}
}
}
return APR_SUCCESS;
}