Project

General

Profile

Feature #1194 » mod_evhost_dot_notation.patch

Patch for 1.4.x branch - admin, 2007-05-25 12:03

View differences:

src/mod_evhost.c (working copy)
s->path_pieces[s->len+1] = buffer_init();
buffer_copy_string_len(s->path_pieces[s->len],pos,ptr-pos);
pos = ptr + 2;
buffer_copy_string_len(s->path_pieces[s->len+1],ptr++,2);
if(*(ptr+2) == '.') {
pos = ptr + 4;
buffer_copy_string_len(s->path_pieces[s->len+1],ptr++,4);
} else {
pos = ptr + 2;
buffer_copy_string_len(s->path_pieces[s->len+1],ptr++,2);
}
s->len += 2;
}
......
if (*(ptr+1) == '%') {
/* %% */
BUFFER_APPEND_STRING_CONST(p->tmp_buf,"%");
} else if (*(ptr+2) == '.') {
/* dot notation in pattern, ie %3.1 insert 1st char of %3 */
char key[3];
int poffset = 0;
strncpy(key, p->conf.path_pieces[i]->ptr, 2);
key[2] = NULL;
ds = (data_string *)array_get_element(parsed_host,key);
/* check if the index is outside the string, indexing starts at 1 in config */
poffset = atoi(ptr+3)-1;
if (ds != NULL && (poffset >= 0 && poffset < ds->value->used)) {
buffer_append_string_len(p->tmp_buf,ds->value->ptr+poffset, 1);
}
} else if (NULL != (ds = (data_string *)array_get_element(parsed_host,p->conf.path_pieces[i]->ptr))) {
if (ds->value->used) {
buffer_append_string_buffer(p->tmp_buf,ds->value);
(1-1/3)