cvs: php4 /main SAPI.c main.c php_globals.h /sapi/apache mod_php4.c
| From: | Christian Stocker | Date: | Thu, 22 Aug 2002 07:48:25 +0000 |
| Subject: | cvs: php4 /main SAPI.c main.c php_globals.h /sapi/apache mod_php4.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13549@lists.php.net to get a copy of this message | ||
chregu Thu Aug 22 03:48:25 2002 EDT
Modified files:
/php4/main SAPI.c main.c php_globals.h
/php4/sapi/apache mod_php4.c
Log:
@ - Added php.ini option "allow_webdav_methods" to allow handling of
@ WebDAV http requests within PHP scripts. (chregu)
# More methods (for DeltaV) will follow.
Index: php4/main/SAPI.c
diff -u php4/main/SAPI.c:1.145 php4/main/SAPI.c:1.146
--- php4/main/SAPI.c:1.145 Mon Aug 5 14:32:05 2002
+++ php4/main/SAPI.c Thu Aug 22 03:48:22 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: SAPI.c,v 1.145 2002/08/05 18:32:05 helly Exp $ */
+/* $Id: SAPI.c,v 1.146 2002/08/22 07:48:22 chregu Exp $ */
#include <ctype.h>
#include <sys/stat.h>
@@ -306,8 +306,16 @@
SG(rfc1867_uploaded_files) = NULL;
if (SG(server_context)) {
- if (SG(request_info).request_method
- && !strcmp(SG(request_info).request_method, "POST")) {
+ if ( SG(request_info).request_method
+ && (!strcmp(SG(request_info).request_method, "POST")
+ || (PG(allow_webdav_methods)
+ && (!strcmp(SG(request_info).request_method, "PROPFIND")
+ || !strcmp(SG(request_info).request_method, "PROPPATCH")
+ || !strcmp(SG(request_info).request_method, "PUT")
+ || !strcmp(SG(request_info).request_method, "MOVE")
+ || !strcmp(SG(request_info).request_method, "POST")
+ || !strcmp(SG(request_info).request_method, "COPY")
+ || !strcmp(SG(request_info).request_method, "LOCK"))))) {
if (!SG(request_info).content_type) {
SG(request_info).content_type_dup = NULL;
if(PG(always_populate_raw_post_data)) {
Index: php4/main/main.c
diff -u php4/main/main.c:1.481 php4/main/main.c:1.482
--- php4/main/main.c:1.481 Tue Aug 20 15:49:37 2002
+++ php4/main/main.c Thu Aug 22 03:48:22 2002
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.481 2002/08/20 19:49:37 helly Exp $ */
+/* $Id: main.c,v 1.482 2002/08/22 07:48:22 chregu Exp $ */
/* {{{ includes
*/
@@ -326,6 +326,7 @@
STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_ALL, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals)
STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals)
+ STD_PHP_INI_BOOLEAN("allow_webdav_methods", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_webdav_methods, php_core_globals, core_globals)
PHP_INI_END()
/* }}} */
Index: php4/main/php_globals.h
diff -u php4/main/php_globals.h:1.80 php4/main/php_globals.h:1.81
--- php4/main/php_globals.h:1.80 Tue Aug 20 15:49:37 2002
+++ php4/main/php_globals.h Thu Aug 22 03:48:22 2002
@@ -139,7 +139,8 @@
zend_bool allow_url_fopen;
zend_bool always_populate_raw_post_data;
-
+
+ zend_bool allow_webdav_methods;
};
Index: php4/sapi/apache/mod_php4.c
diff -u php4/sapi/apache/mod_php4.c:1.140 php4/sapi/apache/mod_php4.c:1.141
--- php4/sapi/apache/mod_php4.c:1.140 Wed Aug 21 20:19:54 2002
+++ php4/sapi/apache/mod_php4.c Thu Aug 22 03:48:23 2002
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php4.c,v 1.140 2002/08/22 00:19:54 sniper Exp $ */
+/* $Id: mod_php4.c,v 1.141 2002/08/22 07:48:23 chregu Exp $ */
#include "php_apache_http.h"
@@ -488,11 +488,6 @@
}
zend_first_try {
- /* We don't accept OPTIONS requests, but take everything else */
- if (r->method_number == M_OPTIONS) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
/* Make sure file exists */
if (filename == NULL && r->finfo.st_mode == 0) {
@@ -502,6 +497,14 @@
per_dir_conf = (HashTable *) get_module_config(r->per_dir_config, &php4_module);
if (per_dir_conf) {
zend_hash_apply((HashTable *) per_dir_conf, (apply_func_t) php_apache_alter_ini_entries
TSRMLS_CC);
+ }
+
+ /* We don't accept OPTIONS requests, but take everything else */
+ if (!PG(allow_webdav_methods)) {
+ if (r->method_number == M_OPTIONS) {
+ r->allowed |= (1 << METHODS) - 1;
+ return DECLINED;
+ }
}
/* If PHP parser engine has been turned off with an "engine off"