Project

General

Profile

Feature #1194 » evhost-1.5.patch

dot additions patch for evhost in1.5 -- patrickdk - Anonymous, 2007-05-25 19:33

View differences:

mod_evhost.c 2007-05-25 15:18:57.403845000 -0400
87 87
                       s->path_pieces[s->len+1] = buffer_init();
88 88

  
89 89
                       buffer_copy_string_len(s->path_pieces[s->len],pos,ptr-pos);
90
                       if(*(ptr+2) == '.') {
91
                                       pos = ptr + 4;  
92
                                       buffer_copy_string_len(s->path_pieces[s->len+1],ptr++,4);  
93
                       } else {  
90 94
                       pos = ptr + 2;
91

  
92 95
                       buffer_copy_string_len(s->path_pieces[s->len+1],ptr++,2);
96
                       }  
93 97

  
94 98
                       s->len += 2;
95 99
               }
......
287 291
                       if (*(ptr+1) == '%') {
288 292
                               /* %% */
289 293
                               BUFFER_APPEND_STRING_CONST(p->tmp_buf,"%");
294
                         } else if (*(ptr+2) == '.') {
295
                                /* dot notation in pattern, ie %3.1 insert 1st char of %3 */
296
                                char key[3];
297
                                int poffset = 0;
298
                                strncpy(key, p->conf.path_pieces[i]->ptr, 2);
299
                                key[2] = (char)NULL;
300
                                ds = (data_string *)array_get_element(parsed_host,key,1);
301

  
302
                                /* check if the index is outside the string, indexing starts at 1 in config */
303
                                poffset = atoi(ptr+3)-1;
304

  
305
                                if (ds != NULL && (poffset >= 0 && poffset < ds->value->used)) {
306
                                               buffer_append_string_len(p->tmp_buf,ds->value->ptr+poffset, 1);
307
                               }
290 308
                       } else if (NULL != (ds = (data_string *)array_get_element(parsed_host, CONST_BUF_LEN(p->conf.path_pieces[i])))) {
291 309
                               if (ds->value->used) {
292 310
                                       buffer_append_string_buffer(p->tmp_buf,ds->value);
(2-2/3)