Changeset 1684

Show
Ignore:
Timestamp:
07/25/08 11:45:06 (6 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1683 r1684  
     12008-07-25  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/handler_redir.c, cherokee/rule_request.c, 
     4        cherokee/rule_request.h, cherokee/connection-protected.h, 
     5        cherokee/connection.c: Fixes a concurrency issue. There were a few 
     6        values that were stored within a common structure. This may end up 
     7        leading the server to build wrong redirection addresses. 
     8 
    192008-07-23  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    210 
  • cherokee/trunk/cherokee/connection-protected.h

    r1673 r1684  
    6262#include "post.h" 
    6363#include "header-protected.h" 
    64  
     64#include "regex.h" 
    6565 
    6666typedef enum { 
     
    183183        cherokee_iocache_entry_t     *io_entry_ref; 
    184184 
    185         int                          *regex_match_ovector
    186         int                          *regex_match_ovecsize; 
     185        int                          regex_ovector[OVECTOR_LEN]
     186        int                          regex_ovecsize; 
    187187}; 
    188188 
  • cherokee/trunk/cherokee/connection.c

    r1680 r1684  
    115115        n->traffic_next         = 0; 
    116116        n->validator            = NULL; 
    117         n->regex_match_ovector  = NULL; 
    118         n->regex_match_ovecsize = NULL; 
    119117        n->timeout              = -1; 
    120118        n->polling_fd           = -1; 
     
    142140        cherokee_header_init (&n->header, header_type_request); 
    143141        cherokee_post_init (&n->post); 
     142 
     143        memset (n->regex_ovector, OVECTOR_LEN * sizeof(int), 0); 
     144        n->regex_ovecsize = 0; 
    144145 
    145146        *conn = n; 
     
    233234        conn->tx_partial           = 0; 
    234235        conn->traffic_next         = 0; 
    235         conn->regex_match_ovector  = NULL; 
    236         conn->regex_match_ovecsize = NULL; 
    237236        conn->polling_multiple     = false; 
     237 
     238        memset (conn->regex_ovector, OVECTOR_LEN * sizeof(int), 0); 
     239        conn->regex_ovecsize = 0; 
    238240 
    239241        if (conn->handler != NULL) { 
  • cherokee/trunk/cherokee/handler_redir.c

    r1621 r1684  
    133133                 */ 
    134134                if ((list->re == NULL) && 
    135                     (conn->regex_match_ovector == NULL)) 
     135                    (conn->regex_ovecsize == 0)) 
    136136                { 
    137                         TRACE (ENTRIES, "Using conn->ovector, size=%d\n", rc); 
     137                        TRACE (ENTRIES, "Using conn->ovector, size=%d\n",  
     138                               conn->regex_ovecsize); 
    138139                }  
    139140 
     
    142143                else if (list->re == NULL) { 
    143144                        memcpy (ovector, 
    144                                 conn->regex_match_ovector, 
     145                                conn->regex_ovector, 
    145146                                OVECTOR_LEN * sizeof(cint_t)); 
    146147                         
    147                         rc = *conn->regex_match_ovecsize; 
     148                        rc = conn->regex_ovecsize; 
    148149                        TRACE (ENTRIES, "Using conn->ovector, size=%d\n", rc); 
    149150                }  
  • cherokee/trunk/cherokee/rule_request.c

    r1614 r1684  
    6868                        conn->request.len,  
    6969                        0, 0,  
    70                         rule->ovector, OVECTOR_LEN); 
     70                        conn->regex_ovector, OVECTOR_LEN); 
    7171 
    7272        if (re < 0) { 
     
    7878        }        
    7979 
    80         rule->ovecsize = re; 
     80        conn->regex_ovecsize = re; 
    8181 
    8282        TRACE (ENTRIES, "Request \"%s\" matches with \"%s\", ovecsize=%d\n",  
    83                conn->request.buf, rule->pattern.buf, rule->ovecsize); 
    84  
    85         /* Store a pointer to the rule. We might want to use 
    86          * rule->ovectors from handler_redir later on. 
    87          */ 
    88         conn->regex_match_ovector  = &rule->ovector[0]; 
    89         conn->regex_match_ovecsize = &rule->ovecsize; 
     83               conn->request.buf, rule->pattern.buf, conn->regex_ovecsize); 
    9084 
    9185        ret = ret_ok; 
  • cherokee/trunk/cherokee/rule_request.h

    r1398 r1684  
    3939typedef struct { 
    4040        cherokee_rule_t   rule; 
    41  
    42         int               ovector[OVECTOR_LEN]; 
    43         int               ovecsize; 
    4441        void             *pcre; 
    4542        cherokee_buffer_t pattern;