Changeset 333
- Timestamp:
- 08/05/06 17:50:03 (2 years ago)
- Files:
-
- cherokee/trunk/cherokee/common-internal.h (modified) (2 diffs)
- cherokee/trunk/cherokee/fdpoll-select.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_admin.c (modified) (2 diffs)
- cherokee/trunk/cherokee/handler_cgi.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_common.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_dirlist.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_error_redir.c (modified) (2 diffs)
- cherokee/trunk/cherokee/handler_fastcgi.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_fcgi.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_file.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_nn.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_phpcgi.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_proxy.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_redir.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_scgi.c (modified) (1 diff)
- cherokee/trunk/cherokee/handler_server_info.c (modified) (1 diff)
- cherokee/trunk/cherokee/header.c (modified) (1 diff)
- cherokee/trunk/cherokee/macros.h (modified) (6 diffs)
- cherokee/trunk/cherokee/module.h (modified) (1 diff)
- cherokee/trunk/cherokee/socket.c (modified) (2 diffs)
- cherokee/trunk/cherokee/util.c (modified) (4 diffs)
- cherokee/trunk/cherokee/util.h (modified) (2 diffs)
- cherokee/trunk/cherokee/validator_htdigest.c (modified) (1 diff)
- cherokee/trunk/cherokee/validator_htpasswd.c (modified) (1 diff)
- cherokee/trunk/cherokee/validator_ldap.c (modified) (1 diff)
- cherokee/trunk/cherokee/validator_pam.c (modified) (2 diffs)
- cherokee/trunk/cherokee/validator_plain.c (modified) (1 diff)
- cherokee/trunk/configure.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/trunk/cherokee/common-internal.h
r187 r333 52 52 #include <stdlib.h> 53 53 #include <string.h> 54 55 #ifdef HAVE_SYS_VARARGS 56 # include <sys/varargs.h> 57 #endif 54 58 55 59 #ifdef HAVE_DLFCN_H … … 116 120 #endif 117 121 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 157 char *strsep(char **str, const char *delims); 158 #endif 159 160 #ifndef HAVE_STRCASESTR 161 char *strcasestr(char *s, char *find); 162 #endif 163 118 164 #endif /* CHEROKEE_COMMON_INTERNAL_H */ cherokee/trunk/cherokee/fdpoll-select.c
r122 r333 30 30 #ifdef HAVE_SYS_SELECT_H 31 31 # include <sys/select.h> 32 #endif 33 34 #ifdef HAVE_SYS_TIME_H 35 # include <sys/time.h> 32 36 #endif 33 37 cherokee/trunk/cherokee/handler_admin.c
r282 r333 35 35 36 36 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 } ;37 static ret_t 38 cherokee_handler_admin_configure () 39 { 40 return ret_ok; 41 } 42 42 43 43 … … 201 201 } 202 202 203 HANDLER_MODULE_INFO_INIT_EASY (admin, http_get | http_post); cherokee/trunk/cherokee/handler_cgi.c
r294 r333 791 791 792 792 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 }; 793 HANDLER_MODULE_INFO_INIT_EASY (cgi, http_get | http_post | http_head); cherokee/trunk/cherokee/handler_common.c
r328 r333 347 347 } 348 348 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 }; 349 HANDLER_MODULE_INFO_INIT_EASY (common, http_all_methods); cherokee/trunk/cherokee/handler_dirlist.c
r283 r333 935 935 } 936 936 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 }; 937 HANDLER_MODULE_INFO_INIT_EASY (dirlist, http_get); cherokee/trunk/cherokee/handler_error_redir.c
r132 r333 32 32 33 33 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 34 ret_t 35 cherokee_handler_error_redir_configure () 36 { 37 return ret_ok; 38 } 40 39 41 40 ret_t … … 78 77 cherokee_module_loader_load (loader, "redir"); 79 78 } 79 80 HANDLER_MODULE_INFO_INIT_EASY (error_redir, http_all_methods); cherokee/trunk/cherokee/handler_fastcgi.c
r294 r333 709 709 } 710 710 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 711 HANDLER_MODULE_INFO_INIT_EASY (fastcgi, http_get | http_post | http_head); 712 cherokee/trunk/cherokee/handler_fcgi.c
r294 r333 709 709 } 710 710 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 711 HANDLER_MODULE_INFO_INIT_EASY (fcgi, http_get | http_post | http_head); 712 cherokee/trunk/cherokee/handler_file.c
r283 r333 657 657 } 658 658 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 }; 659 HANDLER_MODULE_INFO_INIT_EASY (file, http_get | http_head); cherokee/trunk/cherokee/handler_nn.c
r282 r333 170 170 /* Load the dependences 171 171 */ 172 _nn_is_init = true; 172 173 cherokee_module_loader_load (loader, "common"); 173 _nn_is_init = true;174 174 } 175 175 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 }; 176 HANDLER_MODULE_INFO_INIT_EASY (nn, http_all_methods); cherokee/trunk/cherokee/handler_phpcgi.c
r330 r333 260 260 } 261 261 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 262 HANDLER_MODULE_INFO_INIT_EASY (phpcgi, http_get | http_post | http_head); 263 cherokee/trunk/cherokee/handler_proxy.c
r283 r333 313 313 } 314 314 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 }; 315 HANDLER_MODULE_INFO_INIT_EASY (proxy, http_get | http_post | http_head); 316 cherokee/trunk/cherokee/handler_redir.c
r313 r333 413 413 } 414 414 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 415 HANDLER_MODULE_INFO_INIT_EASY (redir, http_all_methods); 416 417 cherokee/trunk/cherokee/handler_scgi.c
r294 r333 376 376 } 377 377 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 }; 378 HANDLER_MODULE_INFO_INIT_EASY (scgi, http_get | http_post | http_head); cherokee/trunk/cherokee/handler_server_info.c
r283 r333 496 496 } 497 497 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 }; 498 HANDLER_MODULE_INFO_INIT_EASY (server_info, http_get); cherokee/trunk/cherokee/header.c
r282 r333 49 49 #else 50 50 # define HEADER_INTERNAL_CHECK(h) 51 #endif52 53 #ifndef HAVE_STRSEP54 extern char *strsep (char** str, const char* delims);55 51 #endif 56 52 cherokee/trunk/cherokee/macros.h
r264 r333 34 34 #include <stdarg.h> 35 35 36 #ifdef HAVE_SYS_VARARGS37 # include <sys/varargs.h>38 #endif39 40 36 #ifdef __cplusplus 41 37 # define CHEROKEE_BEGIN_DECLS extern "C" { … … 44 40 # define CHEROKEE_BEGIN_DECLS 45 41 # 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 46 52 #endif 47 53 … … 109 115 __FILE__, \ 110 116 __LINE__, \ 111 __ func__,\117 __cherokee_func__, \ 112 118 #expr); \ 113 119 return (ret); \ … … 117 123 #define SHOULDNT_HAPPEN \ 118 124 do { fprintf (stderr, "file %s:%d (%s): this shouldn't happend\n", \ 119 __FILE__, __LINE__, __ func__);\125 __FILE__, __LINE__, __cherokee_func__); \ 120 126 } while (0) 121 127 122 128 #define RET_UNKNOWN(ret) \ 123 129 do { fprintf (stderr, "file %s:%d (%s): ret code unknown ret=%d\n", \ 124 __FILE__, __LINE__, __ func__, ret);\130 __FILE__, __LINE__, __cherokee_func__, ret); \ 125 131 } while (0) 126 132 … … 191 197 192 198 # 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__) 196 202 # endif 197 203 #else … … 207 213 #define POINTER_TO_INT(pointer) ((long)(pointer)) 208 214 #define INT_TO_POINTER(integer) ((void*)((long)(integer))) 209 210 /* IMPORTANT:211 * Cross compilers should define BYTE_ORDER in CFLAGS212 */213 #ifndef BYTE_ORDER214 215 /* Definitions for byte order, according to byte significance from low216 * 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, we223 * assume (maybe falsely) the order is LITTLE ENDIAN224 */225 # ifdef WORDS_BIGENDIAN226 # define BYTE_ORDER BIG_ENDIAN227 # else228 # define BYTE_ORDER LITTLE_ENDIAN229 # endif230 231 #endif /* BYTE_ORDER */232 215 233 216 cherokee/trunk/cherokee/module.h
r283 r333 88 88 #define MODULE_INFO_HANDLER(x) ((cherokee_module_info_handler_t *) (x)) 89 89 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) } 92 129 93 130 /* Methods cherokee/trunk/cherokee/socket.c
r303 r333 1137 1137 int re; 1138 1138 1139 socket->is_tls = TLS;1140 1141 1139 # 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 1146 1145 /* Acredentials 1147 1146 */ … … 1178 1177 # elif defined(HAVE_OPENSSL) 1179 1178 1179 socket->is_tls = TLS; 1180 1180 1181 /* New context 1181 1182 */ cherokee/trunk/cherokee/util.c
r324 r333 403 403 cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result) 404 404 { 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 406 410 /* We cannot rely on the return value of readdir_r as it 407 411 * differs between various platforms (HPUX returns 0 on … … 416 420 return 0; 417 421 } 418 422 419 423 *result = NULL; 420 424 return errno; 421 425 422 # elif defined(HAVE_READDIR_R_3)426 # elif defined(HAVE_READDIR_R_3) 423 427 return readdir_r (dirstream, entry, result); 424 425 #else 428 # else 426 429 struct dirent *ptr; 427 430 int ret = 0; 428 431 429 432 CHEROKEE_MUTEX_LOCK (&readdir_mutex); 430 431 errno = 0; 433 434 errno = 0; 432 435 ptr = readdir(dirstream); 433 436 … … 442 445 CHEROKEE_MUTEX_UNLOCK (&readdir_mutex); 443 446 return ret; 444 #endif 447 # endif 448 #endif 445 449 } 446 450 … … 628 632 629 633 ret_t 630 cherokee_gethostbyname (const char *hostname, struct in_addr *addr) 631 { 634 cherokee_gethostbyname (const char *hostname, void *_addr) 635 { 636 struct in_addr *addr = _addr; 637 632 638 #if !defined(HAVE_PTHREAD) || (defined(HAVE_PTHREAD) && !defined(HAVE_GETHOSTBYNAME_R)) 633 639 cherokee/trunk/cherokee/util.h
r282 r333 57 57 #endif 58 58 59 60 61 59 /* Some global information 62 60 */ … … 86 84 */ 87 85 int cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result); 88 ret_t cherokee_gethostbyname (const char *hostname, struct in_addr*addr);86 ret_t cherokee_gethostbyname (const char *hostname, void *addr); 89 87 ret_t cherokee_syslog (int priority, cherokee_buffer_t *buf); 90 88 cherokee/trunk/cherokee/validator_htdigest.c
r330 r333 271 271 } 272 272 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 273 VALIDATOR_MODULE_INFO_INIT_EASY (htdigest, http_auth_basic | http_auth_digest); 274 cherokee/trunk/cherokee/validator_htpasswd.c
r330 r333 367 367 } 368 368 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 369 VALIDATOR_MODULE_INFO_INIT_EASY (htpasswd, http_auth_basic); 370 cherokee/trunk/cherokee/validator_ldap.c
r330 r333 84 84 } 85 85 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 }; 86 VALIDATOR_MODULE_INFO_INIT_EASY (ldap, http_auth_basic); 92 87 cherokee/trunk/cherokee/validator_pam.c
r330 r333 34 34 */ 35 35 #define CHEROKEE_AUTH_SERVICE "cherokee" 36 37 38 ret_t 39 cherokee_validator_pam_configure () 40 { 41 return ret_ok; 42 } 36 43 37 44 … … 218 225 } 219 226 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 }; 227 VALIDATOR_MODULE_INFO_INIT_EASY (pam, http_auth_basic); 228 cherokee/trunk/cherokee/validator_plain.c
r330 r333 245 245 } 246 246 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 }; 247 VALIDATOR_MODULE_INFO_INIT_EASY (plain, http_auth_basic | http_auth_digest); cherokee/trunk/configure.in
r330 r333 220 220 AC_FUNC_MMAP 221 221 222 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir _r flockfile funlockfile)222 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r flockfile funlockfile) 223 223 224 224