]> git.pld-linux.org Git - packages/php.git/blob - php-apache-fixes.patch
new
[packages/php.git] / php-apache-fixes.patch
1 --- php-4.0.4pl1/sapi/apache/mod_php4.c.wiget   Wed Jan  3 23:07:59 2001
2 +++ php-4.0.4pl1/sapi/apache/mod_php4.c Fri Jan 19 17:01:11 2001
3 @@ -59,9 +59,6 @@
4  #include "util_script.h"
5  
6  #include "mod_php4.h"
7 -#if HAVE_MOD_DAV
8 -# include "mod_dav.h"
9 -#endif
10  
11  #undef shutdown
12  
13 @@ -111,8 +108,6 @@
14         int type;
15  } php_per_dir_entry;
16  
17 -php_apache_info_struct php_apache_info;                /* active config */
18 -
19  /* some systems are missing these from their header files */
20  
21  void php_save_umask(void)
22 @@ -440,6 +435,7 @@
23         ELS_FETCH();
24         CLS_FETCH();
25         PLS_FETCH();
26 +       APLS_FETCH();
27  
28         if (setjmp(EG(bailout))!=0) {
29                 return OK;
30 @@ -463,7 +459,7 @@
31         /* If PHP parser engine has been turned off with an "engine off"
32          * directive, then decline to handle this request
33          */
34 -       if (!php_apache_info.engine) {
35 +       if (!AP(engine)) {
36                 r->content_type = php_apache_get_default_mimetype(r SLS_CC);
37                 r->allowed |= (1 << METHODS) - 1;
38                 if (setjmp(EG(bailout))==0) {
39 @@ -485,7 +481,7 @@
40         }
41  #endif
42  
43 -       if (php_apache_info.last_modified) {
44 +       if (AP(last_modified)) {
45  #if MODULE_MAGIC_NUMBER < 19970912
46                 if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
47                         if (setjmp(EG(bailout))==0) {
48 @@ -734,46 +730,6 @@
49  }
50  
51  
52 -#if HAVE_MOD_DAV
53 -
54 -extern int phpdav_mkcol_test_handler(request_rec *r);
55 -extern int phpdav_mkcol_create_handler(request_rec *r);
56 -
57 -/* conf is being read twice (both here and in send_php()) */
58 -int send_parsed_php_dav_script(request_rec *r)
59 -{
60 -       php_apache_info_struct *conf;
61 -
62 -       conf = (php_apache_info_struct *) get_module_config(r->per_dir_config,
63 -                                                                                                       &php4_module);
64 -       return send_php(r, 0, 0, conf->dav_script);
65 -}
66 -
67 -static int php_type_checker(request_rec *r)
68 -{
69 -       php_apache_info_struct *conf;
70 -
71 -       conf = (php_apache_info_struct *)get_module_config(r->per_dir_config,
72 -                                                                                                  &php4_module);
73 -
74 -    /* If DAV support is enabled, use mod_dav's type checker. */
75 -    if (conf->dav_script) {
76 -               dav_api_set_request_handler(r, send_parsed_php_dav_script);
77 -               dav_api_set_mkcol_handlers(r, phpdav_mkcol_test_handler,
78 -                                                                  phpdav_mkcol_create_handler);
79 -               /* leave the rest of the request to mod_dav */
80 -               return dav_api_type_checker(r);
81 -       }
82 -
83 -    return DECLINED;
84 -}
85 -
86 -#else /* HAVE_MOD_DAV */
87 -
88 -# define php_type_checker NULL
89 -
90 -#endif /* HAVE_MOD_DAV */
91 -
92  
93  handler_rec php_handlers[] =
94  {
95 @@ -809,7 +765,7 @@
96         NULL,                                           /* check_user_id */
97         NULL,                                           /* check auth */
98         NULL,                                           /* check access */
99 -       php_type_checker,                       /* type_checker */
100 +       NULL,                                           /* type_checker */
101         NULL,                                           /* fixups */
102         NULL                                            /* logger */
103  #if MODULE_MAGIC_NUMBER >= 19970103
104 --- php-4.0.4pl1/sapi/apache/mod_php4.h.wiget   Mon Jul  3 01:46:50 2000
105 +++ php-4.0.4pl1/sapi/apache/mod_php4.h Fri Jan 19 17:01:11 2001
106 @@ -15,7 +15,7 @@
107     | Authors: Rasmus Lerdorf <rasmus@php.net>                             |
108     +----------------------------------------------------------------------+
109   */
110 -/* $Id$ */
111 +/* $Id$ */
112  
113  #ifndef MOD_PHP4_H
114  #define MOD_PHP4_H
115 @@ -29,12 +29,24 @@
116  typedef struct {
117      long engine;
118      long last_modified;
119 -       char *dav_script;
120         long xbithack;
121 +       long terminate_child;
122  } php_apache_info_struct;
123  
124  extern zend_module_entry apache_module_entry;
125 +
126 +#ifdef ZTS
127 +extern int php_apache_info_id;
128 +#define APLS_D php_apache_info_struct *apache_globals
129 +#define AP(v) (apache_globals->v)
130 +#define APLS_FETCH() APLS_D = ts_resource(php_apache_info_id)
131 +#else
132  extern php_apache_info_struct php_apache_info;
133 +#define APLS_D
134 +#define AP(v) (php_apache_info.v)
135 +#define APLS_FETCH()
136 +#endif
137 +
138  
139  #ifdef WIN32
140  #define S_IXUSR _S_IEXEC
141 --- php-4.0.4pl1/sapi/apache/php_apache.c.wiget Fri Oct 13 21:08:05 2000
142 +++ php-4.0.4pl1/sapi/apache/php_apache.c       Fri Jan 19 17:01:11 2001
143 @@ -17,7 +17,7 @@
144     |          David Sklar <sklar@student.net>                             |
145     +----------------------------------------------------------------------+
146   */
147 -/* $Id$ */
148 +/* $Id$ */
149  
150  #define NO_REGEX_EXTRA_H
151  
152 @@ -45,6 +45,12 @@
153  #include "php_apache_http.h"
154  #include "http_request.h"
155  
156 +#ifdef ZTS
157 +int php_apache_info_id;
158 +#else
159 +php_apache_info_struct php_apache_info;
160 +#endif
161 +
162  #ifdef PHP_WIN32
163  #include "zend.h"
164  #include "ap_compat.h"
165 @@ -61,6 +67,7 @@
166  PHP_FUNCTION(apachelog);
167  PHP_FUNCTION(apache_note);
168  PHP_FUNCTION(apache_lookup_uri);
169 +PHP_FUNCTION(apache_child_terminate);
170  
171  PHP_MINFO_FUNCTION(apache);
172  
173 @@ -69,51 +76,24 @@
174         PHP_FE(getallheaders,                                                   NULL)
175         PHP_FE(apache_note,                                                             NULL)
176         PHP_FE(apache_lookup_uri,                                               NULL)
177 +       PHP_FE(apache_child_terminate,                                  NULL)
178         {NULL, NULL, NULL}
179  };
180  
181  
182 -static PHP_INI_MH(OnChangeApacheInt)
183 -{
184 -       long *p;
185 -       char *base = (char *) &php_apache_info;
186 -
187 -       p = (long *) (base+(size_t) mh_arg1);
188 -
189 -       if (new_value) {
190 -               *p = atoi(new_value);
191 -               return SUCCESS;
192 -       } else {
193 -               return FAILURE;
194 -       }
195 -}
196 -
197 -
198 -static PHP_INI_MH(OnChangeApacheString)
199 -{
200 -       char **p;
201 -       char *base = (char *) &php_apache_info;
202 -
203 -       p = (char **) (base+(size_t) mh_arg1);
204 -
205 -       if (new_value) {
206 -               *p = new_value;
207 -               return SUCCESS;
208 -       } else {
209 -               return FAILURE;
210 -       }
211 -}
212 -
213  PHP_INI_BEGIN()
214 -       PHP_INI_ENTRY1("xbithack",                      "0",                            PHP_INI_ALL,            OnChangeApacheInt,              (void *) XtOffsetOf(php_apache_info_struct, xbithack))
215 -       PHP_INI_ENTRY1("engine",                                "1",                            PHP_INI_ALL,            OnChangeApacheInt,              (void *) XtOffsetOf(php_apache_info_struct, engine))
216 -       PHP_INI_ENTRY1("last_modified",         "0",                            PHP_INI_ALL,            OnChangeApacheInt,              (void *) XtOffsetOf(php_apache_info_struct, last_modified))
217 -       PHP_INI_ENTRY1("dav_script",                    NULL,                           PHP_INI_ALL,            OnChangeApacheString,   (void *) XtOffsetOf(php_apache_info_struct, dav_script))
218 +       STD_PHP_INI_ENTRY("xbithack",                   "0",                            PHP_INI_ALL,            OnUpdateInt,            xbithack, php_apache_info_struct, php_apache_info)
219 +       STD_PHP_INI_ENTRY("engine",                             "1",                            PHP_INI_ALL,            OnUpdateInt,            engine, php_apache_info_struct, php_apache_info)
220 +       STD_PHP_INI_ENTRY("last_modified",              "0",                            PHP_INI_ALL,            OnUpdateInt,            last_modified, php_apache_info_struct, php_apache_info)
221 +       STD_PHP_INI_ENTRY("child_terminate",    "0",                            PHP_INI_ALL,            OnUpdateInt,            terminate_child, php_apache_info_struct, php_apache_info)
222  PHP_INI_END()
223  
224  
225  static PHP_MINIT_FUNCTION(apache)
226  {
227 +#ifdef ZTS
228 +       php_apache_info_id = ts_allocate_id(sizeof(php_apache_info_struct), NULL, NULL);
229 +#endif
230         REGISTER_INI_ENTRIES();
231         return SUCCESS;
232  }
233 @@ -129,6 +109,21 @@
234  zend_module_entry apache_module_entry = {
235         "apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES
236  };
237 +
238 +/* {{{ proto string child_terminate()
239 +   Get and set Apache request notes */
240 +PHP_FUNCTION(apache_child_terminate)
241 +{
242 +       APLS_FETCH();
243 +       SLS_FETCH();
244 +
245 +       if (AP(terminate_child)) {
246 +               ap_child_terminate( ((request_rec *)SG(server_context)) );
247 +       } else { /* tell them to get lost! */
248 +               php_error(E_WARNING, "apache.child_terminate is disabled");
249 +       }
250 +}
251 +/* }}} */
252  
253  /* {{{ proto string apache_note(string note_name [, string note_value])
254     Get and set Apache request notes */
This page took 0.044604 seconds and 3 git commands to generate.