Changeset 332
- Timestamp:
- 08/05/06 10:55:14 (2 years ago)
- Files:
-
- cherokee/branches/0.5/ChangeLog (modified) (1 diff)
- cherokee/branches/0.5/cherokee/common-internal.h (modified) (2 diffs)
- cherokee/branches/0.5/cherokee/fdpoll-select.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_admin.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_cgi.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_common.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_dirlist.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_error_redir.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_fastcgi.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_fcgi.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_file.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_nn.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_phpcgi.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_redir.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_scgi.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/handler_server_info.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/header.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/macros.h (modified) (6 diffs)
- cherokee/branches/0.5/cherokee/module.h (modified) (1 diff)
- cherokee/branches/0.5/cherokee/socket.c (modified) (2 diffs)
- cherokee/branches/0.5/cherokee/util.c (modified) (6 diffs)
- cherokee/branches/0.5/cherokee/util.h (modified) (5 diffs)
- cherokee/branches/0.5/cherokee/validator_htdigest.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/validator_htpasswd.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/validator_pam.c (modified) (1 diff)
- cherokee/branches/0.5/cherokee/validator_plain.c (modified) (1 diff)
- cherokee/branches/0.5/configure.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
cherokee/branches/0.5/ChangeLog
r331 r332 1 2006-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 20 2006-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 1 31 2006-07-31 Alvaro Lopez Ortega <alvaro@alobbs.com> 2 32 cherokee/branches/0.5/cherokee/common-internal.h
r187 r332 52 52 #include <stdlib.h> 53 53 #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 54 62 55 63 #ifdef HAVE_DLFCN_H … … 116 124 #endif 117 125 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 160 char *strsep(char **str, const char *delims); 161 #endif 162 163 #ifndef HAVE_STRCASESTR 164 char *strcasestr(char *s, char *find); 165 #endif 166 118 167 #endif /* CHEROKEE_COMMON_INTERNAL_H */ cherokee/branches/0.5/cherokee/fdpoll-select.c
r122 r332 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/branches/0.5/cherokee/handler_admin.c
r132 r332 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 }; 42 37 HANDLER_MODULE_INFO_INIT_EASY (admin, http_get | http_post); 43 38 44 39 ret_t cherokee/branches/0.5/cherokee/handler_cgi.c
r220 r332 59 59 60 60 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 }; 61 HANDLER_MODULE_INFO_INIT_EASY (cgi, http_get | http_post | http_head); 66 62 67 63 cherokee/branches/0.5/cherokee/handler_common.c
r325 r332 57 57 58 58 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 }; 59 HANDLER_MODULE_INFO_INIT_EASY (common, http_all_methods); 64 60 65 61 cherokee/branches/0.5/cherokee/handler_dirlist.c
r278 r332 55 55 56 56 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 57 HANDLER_MODULE_INFO_INIT_EASY (dirlist, http_get); 63 58 64 59 struct file_entry { cherokee/branches/0.5/cherokee/handler_error_redir.c
r132 r332 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 }; 34 HANDLER_MODULE_INFO_INIT_EASY (error_redir, http_all_methods); 39 35 40 36 cherokee/branches/0.5/cherokee/handler_fastcgi.c
r228 r332 40 40 41 41 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 42 HANDLER_MODULE_INFO_INIT_EASY (fastcgi, http_get | http_post | http_head); 48 43 49 44 static void cherokee/branches/0.5/cherokee/handler_fcgi.c
r237 r332 39 39 set_env_pair (cgi, key, sizeof(key)-1, val, len) 40 40 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 42 HANDLER_MODULE_INFO_INIT_EASY (fcgi, http_get | http_post | http_head); 47 43 48 44 static void set_env_pair (cherokee_handler_cgi_base_t *cgi_base, cherokee/branches/0.5/cherokee/handler_file.c
r224 r332 45 45 46 46 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 }; 47 HANDLER_MODULE_INFO_INIT_EASY (file, http_get | http_head); 52 48 53 49 ret_t cherokee/branches/0.5/cherokee/handler_nn.c
r132 r332 41 41 42 42 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 43 HANDLER_MODULE_INFO_INIT_EASY (nn, http_get | http_head); 49 44 50 45 static ret_t cherokee/branches/0.5/cherokee/handler_phpcgi.c
r329 r332 55 55 56 56 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 }; 57 HANDLER_MODULE_INFO_INIT_EASY (phpcgi, http_get | http_post | http_head); 62 58 63 59 cherokee/branches/0.5/cherokee/handler_redir.c
r312 r332 35 35 #include "list_ext.h" 36 36 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 45 37 #define ENTRIES "handler,redir" 38 39 40 HANDLER_MODULE_INFO_INIT_EASY (redir, http_get | http_post | http_head); 46 41 47 42 cherokee/branches/0.5/cherokee/handler_scgi.c
r214 r332 34 34 #define ENTRIES "handler,cgi" 35 35 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 42 36 #define set_env(cgi,key,val,len) \ 43 37 add_env_pair (cgi, key, sizeof(key)-1, val, len) 44 38 39 40 HANDLER_MODULE_INFO_INIT_EASY (scgi, http_get | http_post | http_head); 45 41 46 42 static void cherokee/branches/0.5/cherokee/handler_server_info.c
r216 r332 38 38 39 39 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 }; 40 HANDLER_MODULE_INFO_INIT_EASY (server_info, http_get); 45 41 46 42 cherokee/branches/0.5/cherokee/header.c
r280 r332 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/branches/0.5/cherokee/macros.h
r199 r332 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 … … 102 108 __FILE__, \ 103 109 __LINE__, \ 104 __ func__,\110 __cherokee_func__, \ 105 111 #expr); \ 106 112 return (ret); \ … … 110 116 #define SHOULDNT_HAPPEN \ 111 117 do { fprintf (stderr, "file %s:%d (%s): this shouldn't happend\n", \ 112 __FILE__, __LINE__, __ func__);\118 __FILE__, __LINE__, __cherokee_func__); \ 113 119 } while (0) 114 120 115 121 #define RET_UNKNOWN(ret) \ 116 122 do { fprintf (stderr, "file %s:%d (%s): ret code unknown ret=%d\n", \ 117 __FILE__, __LINE__, __ func__, ret);\123 __FILE__, __LINE__, __cherokee_func__, ret); \ 118 124 } while (0) 119 125 … … 184 190 185 191 # 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__) 189 195 # endif 190 196 #else … … 200 206 #define POINTER_TO_INT(pointer) ((long)(pointer)) 201 207 #define INT_TO_POINTER(integer) ((void*)((long)(integer))) 202 203 /* IMPORTANT:204 * Cross compilers should define BYTE_ORDER in CFLAGS205 */206 #ifndef BYTE_ORDER207 208 /* Definitions for byte order, according to byte significance from low209 * 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, we216 * assume (maybe falsely) the order is LITTLE ENDIAN217 */218 # ifdef WORDS_BIGENDIAN219 # define BYTE_ORDER BIG_ENDIAN220 # else221 # define BYTE_ORDER LITTLE_ENDIAN222 # endif223 224 #endif /* BYTE_ORDER */225 208 226 209 cherokee/branches/0.5/cherokee/module.h
r212 r332 77 77 #define MODULE_INFO_HANDLER(x) ((cherokee_module_info_handler_t *) (x)) 78 78 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) } 81 112 82 113 cherokee/branches/0.5/cherokee/socket.c
r229 r332 1125 1125 int re; 1126 1126 1127 # ifdef HAVE_GNUTLS 1128 const int kx_priority[] = {GNUTLS_KX_ANON_DH, 0}; 1129 gnutls_anon_client_credentials anoncred; 1130 1127 1131 socket->is_tls = TLS; 1128 1132 1129 # ifdef HAVE_GNUTLS1130 const int kx_priority[] = {GNUTLS_KX_ANON_DH, 0};1131 1132 gnutls_anon_client_credentials anoncred;1133 1134 1133 /* Acredentials 1135 1134 */ … … 1165 1164 1166 1165 # elif defined(HAVE_OPENSSL) 1166 socket->is_tls = TLS; 1167 1167 1168 1168 /* New context cherokee/branches/0.5/cherokee/util.c
r331 r332 71 71 #endif 72 72 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 73 81 #if defined(HAVE_GNUTLS) 74 82 # include <gnutls/gnutls.h> … … 400 408 cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result) 401 409 { 402 #ifdef HAVE_READDIR_H 410 #ifndef HAVE_READDIR 411 # warning "readdir() unimplemented" 412 return ENOSYS; 413 #else 403 414 # ifdef HAVE_READDIR_R_2 404 415 /* We cannot rely on the return value of readdir_r as it … … 420 431 # elif defined(HAVE_READDIR_R_3) 421 432 return readdir_r (dirstream, entry, result); 422 # endif 423 424 #else 433 # else 425 434 struct dirent *ptr; 426 435 int ret = 0; … … 441 450 CHEROKEE_MUTEX_UNLOCK (&readdir_mutex); 442 451 return ret; 443 #endif 452 # endif 453 #endif 444 454 } 445 455 … … 627 637 628 638 ret_t 629 cherokee_gethostbyname (const char *hostname, struct in_addr *addr) 630 { 639 cherokee_gethostbyname (const char *hostname, void *_addr) 640 { 641 struct in_addr *addr = _addr; 631 642 #if !defined(HAVE_PTHREAD) || (defined(HAVE_PTHREAD) && !defined(HAVE_GETHOSTBYNAME_R)) 632 643 … … 1019 1030 return ret_ok; 1020 1031 } 1032 cherokee/branches/0.5/cherokee/util.h
r280 r332 32 32 #include <cherokee/common.h> 33 33 34 #ifdef HAVE_NETINET_IN_H35 # include <netinet/in.h>36 #endif37 38 #ifdef HAVE_ARPA_INET_H39 # include <arpa/inet.h>40 #endif41 42 34 #include <time.h> 43 35 #include <dirent.h> … … 45 37 #include <cherokee/buffer.h> 46 38 #include <cherokee/table.h> 47 48 39 49 40 … … 57 48 # define cherokee_error errno 58 49 #endif 59 60 61 50 62 51 /* Some global information … … 79 68 /* Time management functions 80 69 */ 81 82 70 struct tm *cherokee_gmtime (const time_t *timep, struct tm *result); 83 71 struct tm *cherokee_localtime (const time_t *timep, struct tm *result); … … 87 75 */ 88 76 int cherokee_readdir (DIR *dirstream, struct dirent *entry, struct dirent **result); 89 ret_t cherokee_gethostbyname (const char *hostname, struct in_addr*addr);77 ret_t cherokee_gethostbyname (const char *hostname, void *addr); 90 78 ret_t cherokee_syslog (int priority, cherokee_buffer_t *buf); 91 79 cherokee/branches/0.5/cherokee/validator_htdigest.c
r212 r332 29 29 30 30 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 }; 31 VALIDATOR_MODULE_INFO_INIT_EASY (htdigest, http_auth_basic | http_auth_digest); 32 36 33 37 34 ret_t cherokee/branches/0.5/cherokee/validator_htpasswd.c
r212 r332 39 39 40 40 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 }; 41 VALIDATOR_MODULE_INFO_INIT_EASY (htpasswd, http_auth_basic); 46 42 47 43 cherokee/branches/0.5/cherokee/validator_pam.c
r212 r332 36 36 37 37 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 }; 38 VALIDATOR_MODULE_INFO_INIT_EASY (pam, http_auth_basic); 43 39 44 40 cherokee/branches/0.5/cherokee/validator_plain.c
r212 r332 31 31 32 32 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 }; 33 VALIDATOR_MODULE_INFO_INIT_EASY (plain, http_auth_basic | http_auth_digest); 34 38 35 39 36 ret_t cherokee/branches/0.5/configure.in
r327 r332 219 219 AC_FUNC_MMAP 220 220 221 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir _r)221 AC_CHECK_FUNCS(gmtime gmtime_r localtime localtime_r getrlimit getdtablesize readdir readdir_r) 222 222 223 223