CVS update: php3

From: Date: Fri, 04 Dec 1998 18:30:25 +0000
Subject: CVS update: php3
Groups: php.dev 
Request: Send a blank email to php-dev+get-2667@lists.php.net to get a copy of this message
Date: Friday December 4, 1998 @ 13:30 Author: ssb Update of /repository/php3 In directory asf:/u/temp/cvs-serv25721 Modified Files: mod_php3.c Log Message: simplify the mod_dav interface somewhat Index: php3/mod_php3.c diff -c php3/mod_php3.c:1.85 php3/mod_php3.c:1.86 *** php3/mod_php3.c:1.85 Fri Dec 4 11:42:35 1998 --- php3/mod_php3.c Fri Dec 4 13:30:23 1998 *************** *** 27,33 **** | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> | +----------------------------------------------------------------------+ */ ! /* $Id: mod_php3.c,v 1.85 1998/12/04 16:42:35 ssb Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 27,33 ---- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> | +----------------------------------------------------------------------+ */ ! /* $Id: mod_php3.c,v 1.86 1998/12/04 18:30:23 ssb Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 81,86 **** --- 81,100 ---- #define GLOBAL(x) x #endif + #if WIN32|WINNT + /* popenf isn't working on Windows, use open instead*/ + # ifdef popenf + # undef popenf + # endif + # define popenf(p,n,f,m) open((n),(f),(m)) + # ifdef pclosef + # undef pclosef + # endif + # define pclosef(p,f) close(f) + #else + # define php3i_popenf(p,n,f,m) popenf((p),(n),(f),(m)) + #endif + extern php3_ini_structure php3_ini; /* active config */ extern php3_ini_structure php3_ini_master; /* master copy of config */ *************** *** 161,167 **** umask(GLOBAL(saved_umask)); } ! int send_php3(request_rec *r, int display_source_mode, int preprocessed) { int fd, retval; php3_ini_structure *conf; --- 175,181 ---- umask(GLOBAL(saved_umask)); } ! int send_php3(request_rec *r, int display_source_mode, int preprocessed, char *filename) { int fd, retval; php3_ini_structure *conf; *************** *** 191,205 **** return DECLINED; } /* Open the file */ ! /* popenf isnt working on windows, so lets just open it*/ ! #if WIN32|WINNT ! fd = open(r->filename, O_RDONLY,0); ! #else ! if ((fd = popenf(r->pool, r->filename, O_RDONLY, 0)) == -1) { ! log_reason("file permissions deny server access", r->filename, r); return FORBIDDEN; } ! #endif /* Apache 1.2 has a more complex mechanism for reading POST data */ #if MODULE_MAGIC_NUMBER > 19961007 if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) --- 205,218 ---- return DECLINED; } /* Open the file */ ! if (filename == NULL) { ! filename = r->filename; ! } ! if ((fd = popenf(r->pool, filename, O_RDONLY, 0)) == -1) { ! log_reason("file permissions deny server access", filename, r); return FORBIDDEN; } ! /* Apache 1.2 has a more complex mechanism for reading POST data */ #if MODULE_MAGIC_NUMBER > 19961007 if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) *************** *** 225,231 **** hard_timeout("send", r); php3_save_umask(); ! chdir_file(r->filename); add_common_vars(r); add_cgi_vars(r); apache_php3_module_main(r, fd, display_source_mode, preprocessed, NULL); --- 238,244 ---- hard_timeout("send", r); php3_save_umask(); ! chdir_file(filename); add_common_vars(r); add_cgi_vars(r); apache_php3_module_main(r, fd, display_source_mode, preprocessed, NULL); *************** *** 233,338 **** /* Done, restore umask, turn off timeout, close file and return */ php3_restore_umask(); kill_timeout(r); - #if WIN32|WINNT - close(fd); - #else pclosef(r->pool, fd); - #endif return OK; } int send_parsed_preprocessed_php3(request_rec * r) { ! return send_php3(r, 0, 1); } int send_parsed_php3(request_rec * r) { ! return send_php3(r, 0, 0); } - int send_parsed_php3_source(request_rec * r) { ! return send_php3(r, 1, 0); } - #if HAVE_MOD_DAV - /* Based on the code in send_php3(). - * Removed all the MODULE_MAGIC_NUMER checks from send_php3() since - * mod_dav is written for 1.3. - */ - int send_dav_handling_php3(request_rec *r) - { - int retval; - FILE *fp; - /* ### this declaration should be somewhere else */ - FILE *php3_fopen_wrapper(char *, char *, int, int *, int *); - php3_ini_structure *conf; - - /* mod_dav has already checked that we're using a valid method, - * so there is no need to check it here - */ - - /* grab configuration settings */ - conf = (php3_ini_structure *) get_module_config(r->per_dir_config, - &php3_module); - /* copy to active configuration */ - memcpy(&php3_ini,conf,sizeof(php3_ini_structure)); - - /* the "php3_engine" directive is ignored for DAV requests */ - - /* open the handler script file */ - if (conf->dav_handler_file) { - fp = php3_fopen_wrapper(conf->dav_handler_file, "r", - USE_PATH|IGNORE_URL, NULL, NULL); - } else { - const char *m = - ap_psprintf(r->pool, - "No DAV handler script defined! Please set one " - "with the php3_dav_handler_file directive."); - return dav_api_error_response(r, HTTP_INTERNAL_SERVER_ERROR, NULL, m); - } - if (fp == NULL) { - const char *m = - ap_psprintf(r->pool, - "Unable to open DAV handler script \"%s\"."); - return dav_api_error_response(r, HTTP_INTERNAL_SERVER_ERROR, NULL, m); - } - - if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR))) { - return retval; - } - - if (conf->last_modified) { - update_mtime(r, r->finfo.st_mtime); - set_last_modified(r); - set_etag(r); - } - /* DAV response bodies are in XML by default */ - r->content_type = "text/xml"; - - /* Init timeout */ - hard_timeout("send", r); - - php3_save_umask(); - /* not doing chmod() here, the URI is not necessarily represented - * in the filesystem - */ - add_common_vars(r); - add_cgi_vars(r); - apache_php3_module_main(r, 0, 0, 0, fp); - - /* Done, restore umask, turn off timeout, close file and return */ - php3_restore_umask(); - kill_timeout(r); - - fclose(fp); - - return OK; - } - #endif /* HAVE_MOD_DAV */ - /* * Create the per-directory config structure with defaults from php3_ini_master */ --- 246,270 ---- /* Done, restore umask, turn off timeout, close file and return */ php3_restore_umask(); kill_timeout(r); pclosef(r->pool, fd); return OK; } int send_parsed_preprocessed_php3(request_rec * r) { ! return send_php3(r, 0, 1, NULL); } int send_parsed_php3(request_rec * r) { ! return send_php3(r, 0, 0, NULL); } int send_parsed_php3_source(request_rec * r) { ! return send_php3(r, 1, 0, NULL); } /* * Create the per-directory config structure with defaults from php3_ini_master */ *************** *** 406,413 **** if (add->open_basedir != orig.open_basedir) new->open_basedir = add->open_basedir; if (add->enable_dl != orig.enable_dl) new->enable_dl = add->enable_dl; if (add->asp_tags != orig.asp_tags) new->asp_tags = add->asp_tags; ! if (add->enable_dav != orig.enable_dav) new->enable_dav = add->enable_dav; ! if (add->dav_handler_file != orig.dav_handler_file) new->dav_handler_file = add->dav_handler_file; return new; } --- 338,344 ---- if (add->open_basedir != orig.open_basedir) new->open_basedir = add->open_basedir; if (add->enable_dl != orig.enable_dl) new->enable_dl = add->enable_dl; if (add->asp_tags != orig.asp_tags) new->asp_tags = add->asp_tags; ! if (add->dav_script != orig.dav_script) new->dav_script = add->dav_script; return new; } *************** *** 467,475 **** case 14: conf->asp_tags = val; break; - case 15: - conf->enable_dav = val; - break; } return NULL; } --- 398,403 ---- *************** *** 553,559 **** conf->upload_max_filesize = atol(arg); break; case 20: ! conf->dav_handler_file = pstrdup(cmd->pool, arg); break; } return NULL; --- 481,487 ---- conf->upload_max_filesize = atol(arg); break; case 20: ! conf->dav_script = pstrdup(cmd->pool, arg); break; } return NULL; *************** *** 585,605 **** #if HAVE_MOD_DAV - int php3_dav_method_handler(char *method, - table *headers_in, - dav_xml_doc *body) - { - return DONE; - } ! int php3_dav_mkcol_test(request_rec *r) ! { ! return DONE; ! } ! int php3_dav_mkcol_create(request_rec *r) { ! return DONE; } static int php3_type_checker(request_rec *r) --- 513,530 ---- #if HAVE_MOD_DAV ! extern int phpdav_mkcol_test_handler(request_rec *r); ! extern int phpdav_mkcol_create_handler(request_rec *r); ! /* conf is being read twice (both here and in send_php3()) */ ! int send_parsed_php3_dav_script(request_rec *r) { ! php3_ini_structure *conf; ! ! conf = (php3_ini_structure *) get_module_config(r->per_dir_config, ! &php3_module); ! return send_php3(r, 0, 0, conf->dav_script); } static int php3_type_checker(request_rec *r) *************** *** 610,624 **** &php3_module); /* If DAV support is enabled, use mod_dav's type checker. */ ! if (conf->enable_dav) { ! dav_api_set_request_handler(r, send_dav_handling_php3); ! dav_api_set_mkcol_handlers(r, php3_dav_mkcol_test, php3_dav_mkcol_create); return dav_api_type_checker(r); } return DECLINED; } ! #endif handler_rec php3_handlers[] = --- 535,552 ---- &php3_module); /* If DAV support is enabled, use mod_dav's type checker. */ ! if (conf->dav_script) { ! dav_api_set_request_handler(r, send_parsed_php3_dav_script); ! dav_api_set_mkcol_handlers(r, phpdav_mkcol_test_handler, ! phpdav_mkcol_create_handler); ! /* leave the rest of the request to mod_dav */ return dav_api_type_checker(r); } return DECLINED; } ! ! #endif /* HAVE_MOD_DAV */ handler_rec php3_handlers[] = *************** *** 653,661 **** {"php3_error_append_string", php3take1handler, (void *)17, OR_OPTIONS, TAKE1, "String to add after an error message from PHP"}, {"php3_open_basedir", php3take1handler, (void *)18, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit opening of files to this directory"}, {"php3_upload_max_filesize", php3take1handler, (void *)19, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit uploaded files to this many bytes"}, ! {"php3_dav_handler_file", php3take1handler, (void *)20, OR_OPTIONS|RSRC_CONF, TAKE1, ! "File that is included to set up DAV request handling."}, ! {"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG, "on|off"}, {"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG, "on|off"}, {"php3_magic_quotes_runtime", php3flaghandler, (void *)2, OR_OPTIONS, FLAG, "on|off"}, --- 581,590 ---- {"php3_error_append_string", php3take1handler, (void *)17, OR_OPTIONS, TAKE1, "String to add after an error message from PHP"}, {"php3_open_basedir", php3take1handler, (void *)18, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit opening of files to this directory"}, {"php3_upload_max_filesize", php3take1handler, (void *)19, OR_OPTIONS|RSRC_CONF, TAKE1, "Limit uploaded files to this many bytes"}, ! #if HAVE_MOD_DAV ! {"php3_dav_script", php3take1handler, (void *)20, OR_OPTIONS|RSRC_CONF, TAKE1, ! "Lets PHP handle DAV requests by parsing this script."}, ! #endif {"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG, "on|off"}, {"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG, "on|off"}, {"php3_magic_quotes_runtime", php3flaghandler, (void *)2, OR_OPTIONS, FLAG, "on|off"}, *************** *** 671,678 **** {"php3_magic_quotes_sybase", php3flaghandler, (void *)12, OR_OPTIONS, FLAG, "on|off"}, {"php3_enable_dl", php3flaghandler, (void *)13, RSRC_CONF|ACCESS_CONF, FLAG, "on|off"}, {"php3_asp_tags", php3flaghandler, (void *)14, OR_OPTIONS, FLAG, "on|off"}, - {"php3_enable_dav", php3flaghandler, (void *)15, ACCESS_CONF, FLAG, - "Lets PHP handle DAV requests through mod_dav. on|off"}, {NULL} }; --- 600,605 ---- -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2667) next »