Changeset 333

Show
Ignore:
Timestamp:
08/05/06 17:50:03 (2 years ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/cherokee/common-internal.h

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

    r122 r333  
    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/trunk/cherokee/handler_admin.c

    r282 r333  
    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 }; 
     37static ret_t 
     38cherokee_handler_admin_configure () 
     39
     40        return ret_ok; 
     41} 
    4242 
    4343 
     
    201201} 
    202202 
     203HANDLER_MODULE_INFO_INIT_EASY (admin, http_get | http_post); 
  • cherokee/trunk/cherokee/handler_cgi.c

    r294 r333  
    791791 
    792792 
    793 cherokee_module_info_handler_t MODULE_INFO(cgi) = { 
    794         .module.type      = cherokee_handler,                 /* type         */ 
    795         .module.new_func  = cherokee_handler_cgi_new,         /* new func     */ 
    796         .module.configure = cherokee_handler_cgi_configure,   /* configure    */ 
    797         .valid_methods    = http_get | http_post | http_head  /* http methods */ 
    798 }; 
     793HANDLER_MODULE_INFO_INIT_EASY (cgi, http_get | http_post | http_head); 
  • cherokee/trunk/cherokee/handler_common.c

    r328 r333  
    347347} 
    348348 
    349  
    350 cherokee_module_info_handler_t MODULE_INFO(common) = { 
    351         .module.type      = cherokee_handler,                  /* type         */ 
    352         .module.new_func  = cherokee_handler_common_new,       /* new func     */ 
    353         .module.configure = cherokee_handler_common_configure, /* configure */ 
    354         .valid_methods    = http_all_methods                   /* http methods */ 
    355 }; 
     349HANDLER_MODULE_INFO_INIT_EASY (common, http_all_methods); 
  • cherokee/trunk/cherokee/handler_dirlist.c

    r283 r333  
    935935} 
    936936 
    937  
    938 cherokee_module_info_handler_t MODULE_INFO(dirlist) = { 
    939         .module.type      = cherokee_handler,                   /* type         */ 
    940         .module.new_func  = cherokee_handler_dirlist_new,       /* new func     */ 
    941         .module.configure = cherokee_handler_dirlist_configure, /* configure */ 
    942         .valid_methods    = http_get                            /* http methods */ 
    943 }; 
     937HANDLER_MODULE_INFO_INIT_EASY (dirlist, http_get); 
  • cherokee/trunk/cherokee/handler_error_redir.c

    r132 r333  
    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 }; 
    39  
     34ret_t 
     35cherokee_handler_error_redir_configure () 
     36
     37        return ret_ok; 
     38
    4039 
    4140ret_t  
     
    7877        cherokee_module_loader_load (loader, "redir"); 
    7978} 
     79 
     80HANDLER_MODULE_INFO_INIT_EASY (error_redir, http_all_methods); 
  • cherokee/trunk/cherokee/handler_fastcgi.c

    r294 r333  
    709709} 
    710710 
    711  
    712 cherokee_module_info_handler_t MODULE_INFO(fastcgi) = { 
    713         .module.type      = cherokee_handler,                   /* type         */ 
    714         .module.new_func  = cherokee_handler_fastcgi_new,       /* new func     */ 
    715         .module.configure = cherokee_handler_fastcgi_configure, /* configure */ 
    716         .valid_methods    = http_get | http_post | http_head    /* http methods */ 
    717 }; 
    718  
     711HANDLER_MODULE_INFO_INIT_EASY (fastcgi, http_get | http_post | http_head); 
     712 
  • cherokee/trunk/cherokee/handler_fcgi.c

    r294 r333  
    709709} 
    710710 
    711 cherokee_module_info_handler_t MODULE_INFO(fcgi) = { 
    712         .module.type      = cherokee_handler,                 /* type         */ 
    713         .module.new_func  = cherokee_handler_fcgi_new,        /* new func     */ 
    714         .module.configure = cherokee_handler_fcgi_configure,  /* configure    */ 
    715         .valid_methods    = http_get | http_post | http_head  /* http methods */ 
    716 }; 
    717  
     711HANDLER_MODULE_INFO_INIT_EASY (fcgi, http_get | http_post | http_head); 
     712 
  • cherokee/trunk/cherokee/handler_file.c

    r283 r333  
    657657} 
    658658 
    659 cherokee_module_info_handler_t MODULE_INFO(file) = { 
    660         .module.type      = cherokee_handler,                /* type         */ 
    661         .module.new_func  = cherokee_handler_file_new,       /* new func     */ 
    662         .module.configure = cherokee_handler_file_configure, /* configure */ 
    663         .valid_methods    = http_get | http_head             /* http methods */ 
    664 }; 
     659HANDLER_MODULE_INFO_INIT_EASY (file, http_get | http_head); 
  • cherokee/trunk/cherokee/handler_nn.c

    r282 r333  
    170170        /* Load the dependences 
    171171         */ 
     172        _nn_is_init = true; 
    172173        cherokee_module_loader_load (loader, "common"); 
    173         _nn_is_init = true; 
    174174} 
    175175 
    176  
    177 cherokee_module_info_handler_t MODULE_INFO(nn) = { 
    178         .module.type      = cherokee_handler,              /* type         */ 
    179         .module.new_func  = cherokee_handler_nn_new,       /* new func     */ 
    180         .module.configure = cherokee_handler_nn_configure, /* configure    */ 
    181         .valid_methods    = http_all_methods               /* http methods */ 
    182 }; 
     176HANDLER_MODULE_INFO_INIT_EASY (nn, http_all_methods); 
  • cherokee/trunk/cherokee/handler_phpcgi.c

    r330 r333  
    260260} 
    261261 
    262 cherokee_module_info_handler_t MODULE_INFO(phpcgi) = { 
    263         .module.type      = cherokee_handler,                  /* type         */ 
    264         .module.new_func  = cherokee_handler_phpcgi_new,       /* new func     */ 
    265         .module.configure = cherokee_handler_phpcgi_configure, /* configure    */ 
    266         .valid_methods    = http_get | http_post | http_head   /* http methods */ 
    267 }; 
    268  
     262HANDLER_MODULE_INFO_INIT_EASY (phpcgi, http_get | http_post | http_head); 
     263 
  • cherokee/trunk/cherokee/handler_proxy.c

    r283 r333  
    313313} 
    314314 
    315 cherokee_module_info_handler_t MODULE_INFO(proxy) = { 
    316         .module.type      = cherokee_handler,                  /* type         */ 
    317         .module.new_func  = cherokee_handler_proxy_new,        /* new func     */ 
    318         .module.configure = cherokee_handler_proxy_configure,  /* configure    */ 
    319         .valid_methods    = http_get | http_post | http_head   /* http methods */ 
    320 }; 
     315HANDLER_MODULE_INFO_INIT_EASY (proxy, http_get | http_post | http_head); 
     316 
  • cherokee/trunk/cherokee/handler_redir.c

    r313 r333  
    413413} 
    414414 
    415  
    416 cherokee_module_info_handler_t MODULE_INFO(redir) = { 
    417         .module.type      = cherokee_handler,                  /* type         */ 
    418         .module.new_func  = cherokee_handler_redir_new,        /* new func     */ 
    419         .module.configure = cherokee_handler_redir_configure,  /* configure    */ 
    420         .valid_methods    = http_all_methods                   /* http methods */ 
    421 }; 
    422  
    423  
     415HANDLER_MODULE_INFO_INIT_EASY (redir, http_all_methods); 
     416 
     417 
  • cherokee/trunk/cherokee/handler_scgi.c

    r294 r333  
    376376} 
    377377 
    378  
    379 cherokee_module_info_handler_t MODULE_INFO(scgi) = { 
    380         .module.type      = cherokee_handler,                /* type         */ 
    381         .module.new_func  = cherokee_handler_scgi_new,       /* new func     */ 
    382         .module.configure = cherokee_handler_scgi_configure, /* configure    */ 
    383         .valid_methods    = http_get | http_post | http_head /* http methods */ 
    384 }; 
     378HANDLER_MODULE_INFO_INIT_EASY (scgi, http_get | http_post | http_head); 
  • cherokee/trunk/cherokee/handler_server_info.c

    r283 r333  
    496496} 
    497497 
    498 cherokee_module_info_handler_t MODULE_INFO(server_info) = { 
    499         .module.type      = cherokee_handler,                       /* type         */ 
    500         .module.new_func  = cherokee_handler_server_info_new,       /* new func     */ 
    501         .module.configure = cherokee_handler_server_info_configure, /* configure   */ 
    502         .valid_methods    = http_get                                /* http methods */ 
    503 }; 
     498HANDLER_MODULE_INFO_INIT_EASY (server_info, http_get); 
  • cherokee/trunk/cherokee/header.c

    r282 r333  
    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/trunk/cherokee/macros.h

    r264 r333  
    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 
     
    109115                          __FILE__,                                         \ 
    110116                          __LINE__,                                         \ 
    111                           __func__,                                         \ 
     117                          __cherokee_func__,                                \ 
    112118                          #expr);                                           \ 
    113119                return (ret);                                               \ 
     
    117123#define SHOULDNT_HAPPEN \ 
    118124        do { fprintf (stderr, "file %s:%d (%s): this shouldn't happend\n",  \ 
    119                       __FILE__, __LINE__, __func__);                        \ 
     125                      __FILE__, __LINE__, __cherokee_func__);               \ 
    120126        } while (0) 
    121127 
    122128#define RET_UNKNOWN(ret) \ 
    123129        do { fprintf (stderr, "file %s:%d (%s): ret code unknown ret=%d\n", \ 
    124                       __FILE__, __LINE__, __func__, ret);                   \ 
     130                      __FILE__, __LINE__, __cherokee_func__, ret);          \ 
    125131        } while (0) 
    126132 
     
    191197 
    192198# ifdef __GNUC__ 
    193 #  define TRACE(fmt,arg...) cherokee_trace (fmt, __FILE__, __LINE__, __func__, ##arg) 
    194 # else 
    195 #  define TRACE(fmt,...) cherokee_trace (fmt, __FILE__, __LINE__, __func__, __VA_ARGS__) 
     199#  define TRACE(fmt,arg...) cherokee_trace (fmt, __FILE__, __LINE__, __cherokee_func__, ##arg) 
     200# else 
     201#  define TRACE(fmt,...) cherokee_trace (fmt, __FILE__, __LINE__, __cherokee_func__, __VA_ARGS__) 
    196202# endif 
    197203#else 
     
    207213#define POINTER_TO_INT(pointer) ((long)(pointer)) 
    208214#define INT_TO_POINTER(integer) ((void*)((long)(integer))) 
    209  
    210 /* IMPORTANT: 
    211  * Cross compilers should define BYTE_ORDER in CFLAGS  
    212  */ 
    213 #ifndef BYTE_ORDER 
    214  
    215 /* Definitions for byte order, according to byte significance from low 
    216  * address to high. 
    217  */ 
    218 # define LITTLE_ENDIAN  1234    /* LSB first: i386, vax */ 
    219 # define    BIG_ENDIAN  4321    /* MSB first: 68000, ibm, net */ 
    220 # define    PDP_ENDIAN  3412    /* LSB first in word, MSW first in long */ 
    221  
    222 /* assume autoconf's AC_C_BIGENDIAN has been ran. If it hasn't, we  
    223  * assume (maybe falsely) the order is LITTLE ENDIAN 
    224  */ 
    225 # ifdef WORDS_BIGENDIAN 
    226 #   define BYTE_ORDER  BIG_ENDIAN 
    227 # else 
    228 #   define BYTE_ORDER  LITTLE_ENDIAN 
    229 # endif 
    230  
    231 #endif /* BYTE_ORDER */ 
    232215 
    233216 
  • cherokee/trunk/cherokee/module.h

    r283 r333  
    8888#define MODULE_INFO_HANDLER(x) ((cherokee_module_info_handler_t *) (x)) 
    8989 
    90 #define MODULE_INFO(name) (cherokee_ ## name ## _info) 
    91 #define MODULE_INIT(name) (cherokee_module_ ## name ## _init) 
     90#define MODULE_INFO(name) cherokee_ ## name ## _info 
     91#define MODULE_INIT(name) cherokee_module_ ## name ## _init 
     92 
     93#define HANDLER_MODULE_INFO_INIT(name, type, func, conf, methods) \ 
     94        cherokee_module_info_handler_t MODULE_INFO(name) = {      \ 
     95                {                                                 \ 
     96                        type,                                     \ 
     97                        func,                                     \ 
     98                        conf                                      \ 
     99                },                                                \ 
     100                (methods)                                         \ 
     101        } 
     102 
     103#define VALIDATOR_MODULE_INFO_INIT(name, type, func, conf, methods) \ 
     104        cherokee_module_info_handler_t MODULE_INFO((name)) = {      \ 
     105                {                                                   \ 
     106                        type,                                       \ 
     107                        func,                                       \ 
     108                        conf                                        \ 
     109                },                                                  \ 
     110                (methods)                                           \ 
     111        } 
     112 
     113 
     114/* Handy definitions 
     115 */ 
     116#define HANDLER_MODULE_INFO_INIT_EASY(name, methods)               \ 
     117        cherokee_module_info_handler_t MODULE_INFO(name) = {       \ 
     118                { cherokee_handler,                                \ 
     119                  cherokee_handler_ ## name ## _new,               \ 
     120                  cherokee_handler_ ## name ## _configure,         \ 
     121                }, (methods) } 
     122 
     123#define VALIDATOR_MODULE_INFO_INIT_EASY(name, methods)             \ 
     124        cherokee_module_info_handler_t MODULE_INFO(name) = {       \ 
     125                { cherokee_validator,                              \ 
     126                  cherokee_validator_ ## name ## _new,             \ 
     127                  cherokee_validator_ ## name ## _configure,       \ 
     128                }, (methods) } 
    92129 
    93130/* Methods 
  • cherokee/trunk/cherokee/socket.c

    r303 r333  
    11371137        int re; 
    11381138 
    1139         socket->is_tls = TLS; 
    1140  
    11411139# ifdef HAVE_GNUTLS 
    1142         const int kx_priority[] = {GNUTLS_KX_ANON_DH, 0}; 
    1143  
    1144         gnutls_anon_client_credentials   anoncred; 
    1145          
     1140        const int                       kx_priority[] = {GNUTLS_KX_ANON_DH, 0}; 
     1141        gnutls_anon_client_credentials  anoncred; 
     1142 
     1143        socket->is_tls = TLS;    
     1144 
    11461145        /* Acredentials 
    11471146         */ 
     
    11781177# elif defined(HAVE_OPENSSL) 
    11791178 
     1179        socket->is_tls = TLS; 
     1180 
    11801181        /* New context 
    11811182         */ 
  • cherokee/trunk/cherokee/util.c

    r324 r333  
    403403cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result) 
    404404{ 
    405 #ifdef HAVE_READDIR_R_2 
     405#ifndef HAVE_READDIR 
     406# warning "readdir() unimplemented" 
     407        return ENOSYS; 
     408#else 
     409# ifdef HAVE_READDIR_R_2 
    406410        /* We cannot rely on the return value of readdir_r as it 
    407411         * differs between various platforms (HPUX returns 0 on 
     
    416420                return 0; 
    417421        } 
    418          
     422 
    419423        *result = NULL; 
    420424        return errno; 
    421425 
    422 #elif defined(HAVE_READDIR_R_3) 
     426# elif defined(HAVE_READDIR_R_3) 
    423427        return readdir_r (dirstream, entry, result); 
    424  
    425 #else 
     428# else 
    426429        struct dirent *ptr; 
    427430        int            ret = 0; 
    428          
     431 
    429432        CHEROKEE_MUTEX_LOCK (&readdir_mutex); 
    430          
    431         errno = 0;         
     433 
     434        errno = 0; 
    432435        ptr = readdir(dirstream); 
    433436         
     
    442445        CHEROKEE_MUTEX_UNLOCK (&readdir_mutex); 
    443446        return ret; 
    444 #endif  
     447# endif 
     448#endif 
    445449} 
    446450 
     
    628632 
    629633ret_t 
    630 cherokee_gethostbyname (const char *hostname, struct in_addr *addr) 
    631 
     634cherokee_gethostbyname (const char *hostname, void *_addr) 
     635
     636        struct in_addr *addr = _addr; 
     637         
    632638#if !defined(HAVE_PTHREAD) || (defined(HAVE_PTHREAD) && !defined(HAVE_GETHOSTBYNAME_R)) 
    633639 
  • cherokee/trunk/cherokee/util.h

    r282 r333  
    5757#endif 
    5858 
    59  
    60  
    6159/* Some global information 
    6260 */ 
     
    8684 */ 
    8785int        cherokee_readdir       (DIR *dirstream, struct dirent *entry, struct dirent **result); 
    88 ret_t      cherokee_gethostbyname (const char *hostname, struct in_addr *addr); 
     86ret_t      cherokee_gethostbyname (const char *hostname, void *addr); 
    8987ret_t      cherokee_syslog        (int priority, cherokee_buffer_t *buf); 
    9088 
  • cherokee/trunk/cherokee/validator_htdigest.c

    r330 r333  
    271271} 
    272272 
    273 cherokee_module_info_validator_t MODULE_INFO(htdigest) = { 
    274         .module.type      = cherokee_validator,                    /* type      */ 
    275         .module.new_func  = cherokee_validator_htdigest_new,       /* new func  */ 
    276         .module.configure = cherokee_validator_htdigest_configure, /* configure */ 
    277         .valid_methods    = http_auth_basic | http_auth_digest     /* methods   */ 
    278 }; 
    279  
     273VALIDATOR_MODULE_INFO_INIT_EASY (htdigest, http_auth_basic | http_auth_digest); 
     274 
  • cherokee/trunk/cherokee/validator_htpasswd.c

    r330 r333  
    367367} 
    368368 
    369 cherokee_module_info_validator_t MODULE_INFO(htpasswd) = { 
    370         .module.type      = cherokee_validator,                    /* type      */ 
    371         .module.new_func  = cherokee_validator_htpasswd_new,       /* new func  */ 
    372         .module.configure = cherokee_validator_htpasswd_configure, /* configure */ 
    373         .valid_methods    = http_auth_basic                        /* methods   */ 
    374 }; 
    375  
     369VALIDATOR_MODULE_INFO_INIT_EASY (htpasswd, http_auth_basic); 
     370 
  • cherokee/trunk/cherokee/validator_ldap.c

    r330 r333  
    8484} 
    8585 
    86 cherokee_module_info_validator_t MODULE_INFO(ldap) = { 
    87         .module.type      = cherokee_validator,                /* type      */ 
    88         .module.new_func  = cherokee_validator_ldap_new,       /* new func  */ 
    89         .module.configure = cherokee_validator_ldap_configure, /* configure */ 
    90         .valid_methods    = http_auth_basic                    /* methods   */ 
    91 }; 
     86VALIDATOR_MODULE_INFO_INIT_EASY (ldap, http_auth_basic); 
    9287 
  • cherokee/trunk/cherokee/validator_pam.c

    r330 r333  
    3434 */ 
    3535#define CHEROKEE_AUTH_SERVICE "cherokee" 
     36 
     37 
     38ret_t 
     39cherokee_validator_pam_configure () 
     40{ 
     41        return ret_ok; 
     42} 
    3643 
    3744 
     
    218225} 
    219226 
    220 cherokee_module_info_validator_t MODULE_INFO(pam) = { 
    221         .module.type     = cherokee_validator,                 /* type     */ 
    222         .module.new_func = cherokee_validator_pam_new,         /* new func */ 
    223         .valid_methods   = http_auth_basic                     /* methods  */ 
    224 }; 
     227VALIDATOR_MODULE_INFO_INIT_EASY (pam, http_auth_basic); 
     228 
  • cherokee/trunk/cherokee/validator_plain.c

    r330 r333  
    245245} 
    246246 
    247 cherokee_module_info_validator_t MODULE_INFO(plain) = { 
    248         .module.type      = cherokee_validator,                 /* type     */ 
    249         .module.new_func  = cherokee_validator_plain_new,       /* new func */ 
    250         .module.configure = cherokee_validator_plain_configure, /* config   */ 
    251         .valid_methods    = http_auth_basic | http_auth_digest  /* methods  */ 
    252 }; 
     247VALIDATOR_MODULE_INFO_INIT_EASY (plain, http_auth_basic | http_auth_digest); 
  • cherokee/trunk/configure.in

    r330 r333  
    220220AC_FUNC_MMAP 
    221221 
    222 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir_r flockfile funlockfile) 
     222AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r flockfile funlockfile) 
    223223 
    224224