Changeset 646

Show
Ignore:
Timestamp:
02/18/07 19:14:22 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

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

    r645 r646  
     12007-02-18  A.D.F  <adefacc@tin.it> 
     2 
     3        * cherokee/post.h, cherokee/post.c cherokee/connection.c, 
     4        cherokee/handler_admin.c: 
     5        - use off_t instead of offset_t in order 
     6          to compile cherokee when off_t has a size of 4 bytes 
     7          instead of 8 (i.e. on embedded systems or when 
     8          --disable-largefile is given on configure command line). 
     9 
     10        * cherokee/connection-protected.h: 
     11        - don't use "enum" for bit flags because more than 
     12          one option can be set, so its better to explicitely use 
     13          an unsigned int as data type. 
     14         
    1152007-02-16  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    216 
  • cherokee/trunk/cherokee/buffer.c

    r624 r646  
    16061606/* Substitute (substring)s found in (bufsrc) with (replacement) 
    16071607 * and writes the resulting content to (bufdst). 
    1608  * NOTE: (bufdst) is written only if at least on (substring) instance 
    1609  *       is found in (bufsrc), in this case return value is ret_ok; 
     1608 * NOTE: (bufdst) is written only if at least one (substring) instance 
     1609 *       is found in (bufsrc); in that case return value is ret_ok; 
    16101610 *       if (substring) is NOT found in (bufsrc) then nothing is done 
    16111611 *       in order to avoid an unnecessary copy of data. 
  • cherokee/trunk/cherokee/connection-protected.h

    r642 r646  
    8282} cherokee_connection_phase_t; 
    8383 
    84 typedef enum { 
    85         conn_op_nothing    = 0, 
    86         conn_op_log_at_end = (1 << 0), 
    87         conn_op_root_index = (1 << 1), 
    88         conn_op_tcp_cork   = (1 << 2) 
    89 } cherokee_connection_options_t; 
     84 
     85#define conn_op_nothing       0 
     86#define conn_op_log_at_end   (1 << 0) 
     87#define conn_op_root_index   (1 << 1) 
     88#define conn_op_tcp_cork     (1 << 2) 
     89 
     90typedef cuint_t cherokee_connection_options_t; 
    9091 
    9192 
  • cherokee/trunk/cherokee/connection.c

    r642 r646  
    12861286{ 
    12871287        ret_t    ret; 
    1288         long     post_len; 
     1288        off_t    post_len; 
    12891289        char    *info     = NULL; 
    12901290        cuint_t  info_len = 0; 
     
    13091309        buf[info_len] = '\0'; 
    13101310                 
    1311         post_len = atol(buf); 
     1311        post_len = (off_t) atol(buf); 
    13121312        if (post_len < 0) { 
    13131313                conn->error_code = http_bad_request; 
     
    14431443                /* Set the virtual server reference 
    14441444                 */ 
    1445                 cherokee_server_get_vserver (CONN_SRV(conn), &conn->host, &conn->vserver); 
     1445                cherokee_server_get_vserver (CONN_SRV(conn), &conn->host,  
     1446                                             (cherokee_virtual_server_t **) &conn->vserver); 
    14461447                break; 
    14471448 
  • cherokee/trunk/cherokee/handler_admin.c

    r597 r646  
    124124{ 
    125125        char                    *tmp; 
    126         offset_t                 postl; 
     126        off_t                   postl; 
    127127        ret_t                    ret  = ret_ok; 
    128128        cherokee_buffer_t        post = CHEROKEE_BUF_INIT; 
     
    133133         */ 
    134134        cherokee_post_get_len (&conn->post, &postl); 
    135         if (postl <= 0) { 
     135        if (postl <= 0 || postl >= (INT_MAX-1)) { 
    136136                conn->error_code = http_bad_request; 
    137137                return ret_error; 
     
    140140        /* Process line per line 
    141141         */ 
    142         cherokee_post_walk_read (&conn->post, &post, postl); 
     142        cherokee_post_walk_read (&conn->post, &post, (cuint_t) postl); 
    143143 
    144144        for (tmp = post.buf;;) { 
     
    164164                        goto go_out; 
    165165                } 
    166                  
     166 
    167167                /* Clean up for the next iteration 
    168168                 */ 
    169169                cherokee_buffer_clean (&line); 
    170170        } 
    171          
     171 
    172172go_out: 
    173173        cherokee_buffer_mrproper (&post); 
  • cherokee/trunk/cherokee/post.c

    r597 r646  
    7575 
    7676ret_t  
    77 cherokee_post_set_len (cherokee_post_t *post, offset_t len) 
     77cherokee_post_set_len (cherokee_post_t *post, off_t len) 
    7878{ 
    7979        post->type = (len > POST_SIZE_TO_DISK) ? post_in_tmp_file : post_in_memory; 
     
    8383                char *ptr; 
    8484                char  template[64]; 
    85                  
     85 
    8686                strncpy (template, "/tmp/cherokee_post_XXXXXX", sizeof(template));  
    87                  
     87 
    8888                /* Generate a unique name 
    8989                 */ 
     
    9191                if (unlikely (ptr == NULL))  
    9292                        return ret_error; 
    93                  
     93 
    9494                cherokee_buffer_add (&post->tmp_file, ptr, strlen(ptr)); 
    9595 
     
    100100                        return ret_error; 
    101101        } 
    102          
     102 
    103103        return ret_ok; 
    104104} 
     
    119119 
    120120ret_t  
    121 cherokee_post_get_len (cherokee_post_t *post, offset_t *len) 
     121cherokee_post_get_len (cherokee_post_t *post, off_t *len) 
    122122{ 
    123123        *len = post->size; 
  • cherokee/trunk/cherokee/post.h

    r597 r646  
    6161int   cherokee_post_got_all       (cherokee_post_t *post); 
    6262 
    63 ret_t cherokee_post_set_len       (cherokee_post_t *post, offset_t  len); 
    64 ret_t cherokee_post_get_len       (cherokee_post_t *post, offset_t *len); 
     63ret_t cherokee_post_set_len       (cherokee_post_t *post, off_t  len); 
     64ret_t cherokee_post_get_len       (cherokee_post_t *post, off_t *len); 
    6565 
    6666ret_t cherokee_post_append        (cherokee_post_t *post, char *str, size_t len);