Changeset 332

Show
Ignore:
Timestamp:
08/05/06 10:55:14 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/branches/0.5/ChangeLog

    r331 r332  
     12006-08-05  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/handler_redir.c, cherokee/handler_error_redir.c, 
     4        cherokee/handler_server_info.c, cherokee/handler_admin.c, 
     5        cherokee/handler_dirlist.c, cherokee/handler_nn.c, 
     6        cherokee/handler_common.c, cherokee/validator_plain.c, 
     7        cherokee/validator_htpasswd.c, cherokee/handler_file.c, 
     8        cherokee/handler_fcgi.c, cherokee/handler_fastcgi.c, 
     9        cherokee/handler_scgi.c, cherokee/handler_cgi.c, 
     10        cherokee/validator_htdigest.c, cherokee/handler_phpcgi.c, 
     11        cherokee/validator_pam.c: Moved to use the new modules 
     12        initialization macros. 
     13         
     14        * cherokee/module.h (HANDLER_MODULE_INFO_INIT_EASY, 
     15        VALIDATOR_MODULE_INFO_INIT_EASY): Added two new convenient macros. 
     16 
     17        * cherokee/socket.c (cherokee_socket_init_client_tls): gcc-2.95 
     18        compilation fix. 
     19 
     202006-08-03  A.D.F  <adefacc@tin.it> 
     21 
     22        * cherokee/header.c: Removed strsep() definition.  
     23 
     24        * cherokee/util.h: Added strsep() and strcasestr() prototypes. 
     25 
     26        * cherokee/fdpoll-select.c: Added missing include sys/time.h. 
     27 
     28        * cherokee/module.h (HANDLER_MODULE_INFO_INIT, 
     29        VALIDATOR_MODULE_INFO_INIT): Fixed to be compilator neutral. 
     30         
    1312006-07-31  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
    232 
  • cherokee/branches/0.5/cherokee/common-internal.h

    r187 r332  
    5252#include <stdlib.h> 
    5353#include <string.h> 
     54 
     55#ifdef HAVE_ENDIAN_H 
     56# include <endian.h> 
     57#endif 
     58 
     59#ifdef HAVE_SYS_VARARGS 
     60# include <sys/varargs.h> 
     61#endif 
    5462 
    5563#ifdef HAVE_DLFCN_H 
     
    116124#endif 
    117125 
     126 
     127/* IMPORTANT: 
     128 * Cross compilers should define BYTE_ORDER in CFLAGS  
     129 */ 
     130#ifndef BYTE_ORDER 
     131 
     132/* Definitions for byte order, according to byte significance from low 
     133 * address to high. 
     134 */ 
     135# ifndef  LITTLE_ENDIAN 
     136#  define LITTLE_ENDIAN  1234    /* LSB first: i386, vax */ 
     137# endif 
     138# ifndef BIG_ENDIAN 
     139#  define BIG_ENDIAN     4321    /* MSB first: 68000, ibm, net */ 
     140# endif  
     141# ifndef PDP_ENDIAN 
     142#  define PDP_ENDIAN     3412    /* LSB first in word, MSW first in long */ 
     143# endif 
     144 
     145/* It assumes autoconf's AC_C_BIGENDIAN has been ran.  
     146 * If it hasn't, we assume the order is LITTLE ENDIAN. 
     147 */ 
     148# ifdef WORDS_BIGENDIAN 
     149#   define BYTE_ORDER  BIG_ENDIAN 
     150# else 
     151#   define BYTE_ORDER  LITTLE_ENDIAN 
     152# endif 
     153 
     154#endif 
     155 
     156/* String missing prototypes:  
     157 * Implemented in util.c, can't move prototype there though 
     158 */ 
     159#ifndef HAVE_STRSEP 
     160char *strsep(char **str, const char *delims); 
     161#endif 
     162 
     163#ifndef HAVE_STRCASESTR 
     164char *strcasestr(char *s, char *find); 
     165#endif 
     166 
    118167#endif /* CHEROKEE_COMMON_INTERNAL_H */ 
  • cherokee/branches/0.5/cherokee/fdpoll-select.c

    r122 r332  
    3030#ifdef HAVE_SYS_SELECT_H 
    3131# include <sys/select.h> 
     32#endif 
     33 
     34#ifdef HAVE_SYS_TIME_H 
     35# include <sys/time.h> 
    3236#endif 
    3337 
  • cherokee/branches/0.5/cherokee/handler_admin.c

    r132 r332  
    3535 
    3636 
    37 cherokee_module_info_handler_t MODULE_INFO(admin) = { 
    38         .module.type     = cherokee_handler,               /* type         */ 
    39         .module.new_func = cherokee_handler_admin_new,     /* new func     */ 
    40         .valid_methods   = http_get | http_post            /* http methods */ 
    41 }; 
    42  
     37HANDLER_MODULE_INFO_INIT_EASY (admin, http_get | http_post); 
    4338 
    4439ret_t  
  • cherokee/branches/0.5/cherokee/handler_cgi.c

    r220 r332  
    5959 
    6060 
    61 cherokee_module_info_handler_t MODULE_INFO(cgi) = { 
    62         .module.type     = cherokee_handler,                /* type         */ 
    63         .module.new_func = cherokee_handler_cgi_new,        /* new func     */ 
    64         .valid_methods   = http_get | http_post | http_head /* http methods */ 
    65 }; 
     61HANDLER_MODULE_INFO_INIT_EASY (cgi, http_get | http_post | http_head); 
    6662 
    6763 
  • cherokee/branches/0.5/cherokee/handler_common.c

    r325 r332  
    5757 
    5858 
    59 cherokee_module_info_handler_t MODULE_INFO(common) = { 
    60         .module.type     = cherokee_handler,                /* type         */ 
    61         .module.new_func = cherokee_handler_common_new,     /* new func     */ 
    62         .valid_methods   = http_all_methods                 /* http methods */ 
    63 }; 
     59HANDLER_MODULE_INFO_INIT_EASY (common, http_all_methods); 
    6460 
    6561 
  • cherokee/branches/0.5/cherokee/handler_dirlist.c

    r278 r332  
    5555 
    5656 
    57 cherokee_module_info_handler_t MODULE_INFO(dirlist) = { 
    58         .module.type     = cherokee_handler,               /* type         */ 
    59         .module.new_func = cherokee_handler_dirlist_new,   /* new func     */ 
    60         .valid_methods   = http_get                        /* http methods */ 
    61 }; 
    62  
     57HANDLER_MODULE_INFO_INIT_EASY (dirlist, http_get); 
    6358 
    6459struct file_entry { 
  • cherokee/branches/0.5/cherokee/handler_error_redir.c

    r132 r332  
    3232 
    3333 
    34 cherokee_module_info_handler_t MODULE_INFO(error_redir) = { 
    35         .module.type     = cherokee_handler,                 /* type         */ 
    36         .module.new_func = cherokee_handler_error_redir_new, /* new func     */ 
    37         .valid_methods   = http_all_methods                  /* http methods */ 
    38 }; 
     34HANDLER_MODULE_INFO_INIT_EASY (error_redir, http_all_methods); 
    3935 
    4036 
  • cherokee/branches/0.5/cherokee/handler_fastcgi.c

    r228 r332  
    4040 
    4141 
    42 cherokee_module_info_handler_t MODULE_INFO(fastcgi) = { 
    43         .module.type     = cherokee_handler,                /* type         */ 
    44         .module.new_func = cherokee_handler_fastcgi_new,    /* new func     */ 
    45         .valid_methods   = http_get | http_post | http_head /* http methods */ 
    46 }; 
    47  
     42HANDLER_MODULE_INFO_INIT_EASY (fastcgi, http_get | http_post | http_head); 
    4843 
    4944static void 
  • cherokee/branches/0.5/cherokee/handler_fcgi.c

    r237 r332  
    3939        set_env_pair (cgi, key, sizeof(key)-1, val, len) 
    4040 
    41 cherokee_module_info_handler_t MODULE_INFO(fcgi) = { 
    42         .module.type     = cherokee_handler,                /* type         */ 
    43         .module.new_func = cherokee_handler_fcgi_new,       /* new func     */ 
    44         .valid_methods   = http_get | http_post | http_head /* http methods */ 
    45 }; 
    46  
     41 
     42HANDLER_MODULE_INFO_INIT_EASY (fcgi, http_get | http_post | http_head); 
    4743 
    4844static void set_env_pair (cherokee_handler_cgi_base_t *cgi_base,  
  • cherokee/branches/0.5/cherokee/handler_file.c

    r224 r332  
    4545 
    4646 
    47 cherokee_module_info_handler_t MODULE_INFO(file) = { 
    48         .module.type     = cherokee_handler,            /* type         */ 
    49         .module.new_func = cherokee_handler_file_new,   /* new func     */ 
    50         .valid_methods   = http_get | http_head         /* http methods */ 
    51 }; 
     47HANDLER_MODULE_INFO_INIT_EASY (file, http_get | http_head); 
    5248 
    5349ret_t 
  • cherokee/branches/0.5/cherokee/handler_nn.c

    r132 r332  
    4141 
    4242 
    43 cherokee_module_info_handler_t MODULE_INFO(nn) = { 
    44         .module.type     = cherokee_handler,            /* type         */ 
    45         .module.new_func = cherokee_handler_nn_new,     /* new func     */ 
    46         .valid_methods   = http_get | http_head         /* http methods */ 
    47 }; 
    48  
     43HANDLER_MODULE_INFO_INIT_EASY (nn, http_get | http_head); 
    4944 
    5045static ret_t 
  • cherokee/branches/0.5/cherokee/handler_phpcgi.c

    r329 r332  
    5555 
    5656 
    57 cherokee_module_info_handler_t MODULE_INFO(phpcgi) = { 
    58         .module.type     = cherokee_handler,                /* type         */ 
    59         .module.new_func = cherokee_handler_phpcgi_new,     /* new func     */ 
    60         .valid_methods   = http_get | http_post | http_head /* http methods */ 
    61 }; 
     57HANDLER_MODULE_INFO_INIT_EASY (phpcgi, http_get | http_post | http_head); 
    6258 
    6359 
  • cherokee/branches/0.5/cherokee/handler_redir.c

    r312 r332  
    3535#include "list_ext.h" 
    3636 
    37  
    38 cherokee_module_info_handler_t MODULE_INFO(redir) = { 
    39         .module.type     = cherokee_handler,              /* type         */ 
    40         .module.new_func = cherokee_handler_redir_new,    /* new func     */ 
    41         .valid_methods   = http_all_methods               /* http methods */ 
    42 }; 
    43  
    44  
    4537#define ENTRIES "handler,redir" 
     38 
     39 
     40HANDLER_MODULE_INFO_INIT_EASY (redir, http_get | http_post | http_head); 
    4641 
    4742 
  • cherokee/branches/0.5/cherokee/handler_scgi.c

    r214 r332  
    3434#define ENTRIES "handler,cgi" 
    3535 
    36 cherokee_module_info_handler_t MODULE_INFO(scgi) = { 
    37         .module.type     = cherokee_handler,                /* type         */ 
    38         .module.new_func = cherokee_handler_scgi_new,       /* new func     */ 
    39         .valid_methods   = http_get | http_post | http_head /* http methods */ 
    40 }; 
    41  
    4236#define set_env(cgi,key,val,len) \ 
    4337        add_env_pair (cgi, key, sizeof(key)-1, val, len) 
    4438 
     39 
     40HANDLER_MODULE_INFO_INIT_EASY (scgi, http_get | http_post | http_head); 
    4541 
    4642static void  
  • cherokee/branches/0.5/cherokee/handler_server_info.c

    r216 r332  
    3838 
    3939 
    40 cherokee_module_info_handler_t MODULE_INFO(server_info) = { 
    41         .module.type     = cherokee_handler,                   /* type         */ 
    42         .module.new_func = cherokee_handler_server_info_new,   /* new func     */ 
    43         .valid_methods   = http_get                            /* http methods */ 
    44 }; 
     40HANDLER_MODULE_INFO_INIT_EASY (server_info, http_get); 
    4541 
    4642 
  • cherokee/branches/0.5/cherokee/header.c

    r280 r332  
    4949#else 
    5050# define HEADER_INTERNAL_CHECK(h) 
    51 #endif 
    52  
    53 #ifndef HAVE_STRSEP 
    54   extern char *strsep (char** str, const char* delims); 
    5551#endif 
    5652 
  • cherokee/branches/0.5/cherokee/macros.h

    r199 r332  
    3434#include <stdarg.h> 
    3535 
    36 #ifdef HAVE_SYS_VARARGS 
    37 # include <sys/varargs.h> 
    38 #endif 
    39  
    4036#ifdef  __cplusplus 
    4137#  define CHEROKEE_BEGIN_DECLS  extern "C" { 
     
    4440#  define CHEROKEE_BEGIN_DECLS 
    4541#  define CHEROKEE_END_DECLS 
     42#endif 
     43 
     44#ifdef __func__ 
     45# define __cherokee_func__ __func__ 
     46#else 
     47# ifdef __FUNCTION__ 
     48#  define __cherokee_func__ __FUNCTION__ 
     49# else 
     50#  define __cherokee_func__ "<unknown function>" 
     51# endif 
    4652#endif 
    4753 
     
    102108                          __FILE__,                                         \ 
    103109                          __LINE__,                                         \ 
    104                           __func__,                                         \ 
     110                          __cherokee_func__,                                \ 
    105111                          #expr);                                           \ 
    106112                return (ret);                                               \ 
     
    110116#define SHOULDNT_HAPPEN \ 
    111117        do { fprintf (stderr, "file %s:%d (%s): this shouldn't happend\n",  \ 
    112                       __FILE__, __LINE__, __func__);                        \ 
     118                      __FILE__, __LINE__, __cherokee_func__);               \ 
    113119        } while (0) 
    114120 
    115121#define RET_UNKNOWN(ret) \ 
    116122        do { fprintf (stderr, "file %s:%d (%s): ret code unknown ret=%d\n", \ 
    117                       __FILE__, __LINE__, __func__, ret);                   \ 
     123                      __FILE__, __LINE__, __cherokee_func__, ret);          \ 
    118124        } while (0) 
    119125 
     
    184190 
    185191# ifdef __GNUC__ 
    186 #  define TRACE(fmt,arg...) cherokee_trace (fmt, __FILE__, __LINE__, __func__, ##arg) 
    187 # else 
    188 #  define TRACE(fmt,...) cherokee_trace (fmt, __FILE__, __LINE__, __func__, __VA_ARGS__) 
     192#  define TRACE(fmt,arg...) cherokee_trace (fmt, __FILE__, __LINE__, __cherokee_func__, ##arg) 
     193# else 
     194#  define TRACE(fmt,...) cherokee_trace (fmt, __FILE__, __LINE__, __cherokee_func__, __VA_ARGS__) 
    189195# endif 
    190196#else 
     
    200206#define POINTER_TO_INT(pointer) ((long)(pointer)) 
    201207#define INT_TO_POINTER(integer) ((void*)((long)(integer))) 
    202  
    203 /* IMPORTANT: 
    204  * Cross compilers should define BYTE_ORDER in CFLAGS  
    205  */ 
    206 #ifndef BYTE_ORDER 
    207  
    208 /* Definitions for byte order, according to byte significance from low 
    209  * address to high. 
    210  */ 
    211 # define LITTLE_ENDIAN  1234    /* LSB first: i386, vax */ 
    212 # define    BIG_ENDIAN  4321    /* MSB first: 68000, ibm, net */ 
    213 # define    PDP_ENDIAN  3412    /* LSB first in word, MSW first in long */ 
    214  
    215 /* assume autoconf's AC_C_BIGENDIAN has been ran. If it hasn't, we  
    216  * assume (maybe falsely) the order is LITTLE ENDIAN 
    217  */ 
    218 # ifdef WORDS_BIGENDIAN 
    219 #   define BYTE_ORDER  BIG_ENDIAN 
    220 # else 
    221 #   define BYTE_ORDER  LITTLE_ENDIAN 
    222 # endif 
    223  
    224 #endif /* BYTE_ORDER */ 
    225208 
    226209 
  • cherokee/branches/0.5/cherokee/module.h

    r212 r332  
    7777#define MODULE_INFO_HANDLER(x) ((cherokee_module_info_handler_t *) (x)) 
    7878 
    79 #define MODULE_INFO(name) (cherokee_ ## name ## _info) 
    80 #define MODULE_INIT(name) (cherokee_module_ ## name ## _init) 
     79#define MODULE_INFO(name) cherokee_ ## name ## _info 
     80#define MODULE_INIT(name) cherokee_module_ ## name ## _init 
     81 
     82#define HANDLER_MODULE_INFO_INIT(name, type, func, methods)     \ 
     83        cherokee_module_info_handler_t MODULE_INFO(name) = {    \ 
     84                {                                               \ 
     85                        type,                                   \ 
     86                        func                                    \ 
     87                },                                              \ 
     88                (methods)                                       \ 
     89        }                                  
     90 
     91#define VALIDATOR_MODULE_INFO_INIT(type, func, methods, name)   \ 
     92        cherokee_module_info_handler_t MODULE_INFO(name) = {    \ 
     93                {                                               \ 
     94                        type,                                   \ 
     95                        func                                    \ 
     96                },                                              \ 
     97                (methods)                                       \ 
     98        } 
     99 
     100 
     101/* Handy definitions 
     102 */ 
     103#define HANDLER_MODULE_INFO_INIT_EASY(name, methods)                     \ 
     104        cherokee_module_info_handler_t MODULE_INFO(name) = {             \ 
     105                { cherokee_handler, cherokee_handler_ ## name ## _new }, \ 
     106                (methods) } 
     107 
     108#define VALIDATOR_MODULE_INFO_INIT_EASY(name, methods)                       \ 
     109        cherokee_module_info_handler_t MODULE_INFO(name) = {                 \ 
     110                { cherokee_validator, cherokee_validator_ ## name ## _new }, \ 
     111                (methods) } 
    81112 
    82113 
  • cherokee/branches/0.5/cherokee/socket.c

    r229 r332  
    11251125        int re; 
    11261126 
     1127# ifdef HAVE_GNUTLS 
     1128        const int                        kx_priority[] = {GNUTLS_KX_ANON_DH, 0}; 
     1129        gnutls_anon_client_credentials   anoncred; 
     1130         
    11271131        socket->is_tls = TLS; 
    11281132 
    1129 # ifdef HAVE_GNUTLS 
    1130         const int kx_priority[] = {GNUTLS_KX_ANON_DH, 0}; 
    1131  
    1132         gnutls_anon_client_credentials   anoncred; 
    1133          
    11341133        /* Acredentials 
    11351134         */ 
     
    11651164 
    11661165# elif defined(HAVE_OPENSSL) 
     1166        socket->is_tls = TLS; 
    11671167 
    11681168        /* New context 
  • cherokee/branches/0.5/cherokee/util.c

    r331 r332  
    7171#endif 
    7272 
     73#ifdef HAVE_NETINET_IN_H 
     74# include <netinet/in.h> 
     75#endif 
     76 
     77#ifdef HAVE_ARPA_INET_H 
     78# include <arpa/inet.h> 
     79#endif  
     80 
    7381#if defined(HAVE_GNUTLS) 
    7482# include <gnutls/gnutls.h> 
     
    400408cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result) 
    401409{ 
    402 #ifdef HAVE_READDIR_H 
     410#ifndef HAVE_READDIR 
     411# warning "readdir() unimplemented" 
     412        return ENOSYS; 
     413#else 
    403414# ifdef HAVE_READDIR_R_2 
    404415        /* We cannot rely on the return value of readdir_r as it 
     
    420431# elif defined(HAVE_READDIR_R_3) 
    421432        return readdir_r (dirstream, entry, result); 
    422 # endif 
    423  
    424 #else 
     433# else 
    425434        struct dirent *ptr; 
    426435        int            ret = 0; 
     
    441450        CHEROKEE_MUTEX_UNLOCK (&readdir_mutex); 
    442451        return ret; 
    443 #endif  
     452# endif 
     453#endif 
    444454} 
    445455 
     
    627637 
    628638ret_t 
    629 cherokee_gethostbyname (const char *hostname, struct in_addr *addr) 
    630 
     639cherokee_gethostbyname (const char *hostname, void *_addr) 
     640
     641        struct in_addr *addr = _addr; 
    631642#if !defined(HAVE_PTHREAD) || (defined(HAVE_PTHREAD) && !defined(HAVE_GETHOSTBYNAME_R)) 
    632643 
     
    10191030        return ret_ok; 
    10201031} 
     1032 
  • cherokee/branches/0.5/cherokee/util.h

    r280 r332  
    3232#include <cherokee/common.h> 
    3333 
    34 #ifdef HAVE_NETINET_IN_H 
    35 # include <netinet/in.h> 
    36 #endif 
    37  
    38 #ifdef HAVE_ARPA_INET_H 
    39 # include <arpa/inet.h> 
    40 #endif  
    41  
    4234#include <time.h> 
    4335#include <dirent.h> 
     
    4537#include <cherokee/buffer.h> 
    4638#include <cherokee/table.h> 
    47  
    4839 
    4940 
     
    5748# define cherokee_error          errno 
    5849#endif 
    59  
    60  
    6150 
    6251/* Some global information 
     
    7968/* Time management functions 
    8069 */ 
    81  
    8270struct tm *cherokee_gmtime           (const time_t *timep, struct tm *result); 
    8371struct tm *cherokee_localtime        (const time_t *timep, struct tm *result); 
     
    8775 */ 
    8876int        cherokee_readdir       (DIR *dirstream, struct dirent *entry, struct dirent **result); 
    89 ret_t      cherokee_gethostbyname (const char *hostname, struct in_addr *addr); 
     77ret_t      cherokee_gethostbyname (const char *hostname, void *addr); 
    9078ret_t      cherokee_syslog        (int priority, cherokee_buffer_t *buf); 
    9179 
  • cherokee/branches/0.5/cherokee/validator_htdigest.c

    r212 r332  
    2929 
    3030 
    31 cherokee_module_info_validator_t MODULE_INFO(htdigest) = { 
    32         .module.type     = cherokee_validator,                 /* type     */ 
    33         .module.new_func = cherokee_validator_htdigest_new,    /* new func */ 
    34         .valid_methods   = http_auth_basic | http_auth_digest  /* methods  */ 
    35 }; 
     31VALIDATOR_MODULE_INFO_INIT_EASY (htdigest, http_auth_basic | http_auth_digest); 
     32 
    3633 
    3734ret_t  
  • cherokee/branches/0.5/cherokee/validator_htpasswd.c

    r212 r332  
    3939 
    4040 
    41 cherokee_module_info_validator_t MODULE_INFO(htpasswd) = { 
    42         .module.type     = cherokee_validator,                 /* type     */ 
    43         .module.new_func = cherokee_validator_htpasswd_new,    /* new func */ 
    44         .valid_methods   = http_auth_basic                     /* methods  */ 
    45 }; 
     41VALIDATOR_MODULE_INFO_INIT_EASY (htpasswd, http_auth_basic); 
    4642 
    4743 
  • cherokee/branches/0.5/cherokee/validator_pam.c

    r212 r332  
    3636 
    3737 
    38 cherokee_module_info_validator_t MODULE_INFO(pam) = { 
    39         .module.type     = cherokee_validator,                 /* type     */ 
    40         .module.new_func = cherokee_validator_pam_new,         /* new func */ 
    41         .valid_methods   = http_auth_basic                     /* methods  */ 
    42 }; 
     38VALIDATOR_MODULE_INFO_INIT_EASY (pam, http_auth_basic); 
    4339 
    4440 
  • cherokee/branches/0.5/cherokee/validator_plain.c

    r212 r332  
    3131 
    3232 
    33 cherokee_module_info_validator_t MODULE_INFO(plain) = { 
    34         .module.type     = cherokee_validator,                 /* type     */ 
    35         .module.new_func = cherokee_validator_plain_new,       /* new func */ 
    36         .valid_methods   = http_auth_basic | http_auth_digest  /* methods  */ 
    37 }; 
     33VALIDATOR_MODULE_INFO_INIT_EASY (plain, http_auth_basic | http_auth_digest); 
     34 
    3835 
    3936ret_t  
  • cherokee/branches/0.5/configure.in

    r327 r332  
    219219AC_FUNC_MMAP 
    220220 
    221 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir_r) 
     221AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r) 
    222222 
    223223