]> granicus.if.org Git - php/commitdiff
* Get Apache module to compile again with the regex stuff.
authorZeev Suraski <zeev@php.net>
Fri, 28 May 1999 22:41:48 +0000 (22:41 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 28 May 1999 22:41:48 +0000 (22:41 +0000)
* Get Apache to propertly work with POST, and some SAPI fixes

configure.in.in
ext/pcre/config.m4
ext/pcre/config0.m4
main/SAPI.c
main/rfc1867.c
mod_php4.c

index 29b474ef8bd4bde10a43fa11b564b62438bd1f5f..89b3414e48980c1ae59d573a1030a1903d0eea21 100644 (file)
@@ -298,6 +298,12 @@ fi
 
 divert(2)
 
+abs_srcdir=`(cd $srcdir; pwd)`
+abs_builddir=`pwd`
+AC_SUBST(abs_srcdir)
+AC_SUBST(abs_builddir)
+
+AC_MSG_CHECKING(for Apache module support via DSO through APACI)
 AC_MSG_CHECKING(whether to use bundled regex library)
 AC_ARG_WITH(system-regex,
 [  --with-system-regex     Do not use the bundled regex library],
@@ -308,7 +314,7 @@ AC_ARG_WITH(system-regex,
        AC_DEFINE(REGEX,0)
 ],[
        REGEX_LIB=regex/libregex.a
-       EXTRA_LIBS="-Lregex -lregex $EXTRA_LIBS"
+       EXTRA_LIBS="-L$abs_builddir/regex -lregex $EXTRA_LIBS"
        HSREGEX=yes
        AC_MSG_RESULT(yes)
     AC_DEFINE(HSREGEX)
@@ -354,12 +360,6 @@ AC_ARG_WITH(apxs,
 
 APACHE_INSTALL_FILES="$srcdir/mod_php4.* libphp4.module"
 
-abs_srcdir=`(cd $srcdir; pwd)`
-abs_builddir=`pwd`
-AC_SUBST(abs_srcdir)
-AC_SUBST(abs_builddir)
-
-AC_MSG_CHECKING(for Apache module support via DSO through APACI)
 AC_ARG_WITH(shared-apache,
 [  --with-shared-apache[=DIR] Build shared Apache module.  DIR is the top-level 
                           Apache build directory, defaults to /usr/local/etc/httpd.
index 2f25c8680320c2f21f494d002e66b00889ae9999..e2a903178fe0586279496dd5ef7247bed94158c2 100644 (file)
@@ -8,7 +8,7 @@ AC_MSG_CHECKING(whether to include PCRE support)
 AC_ARG_WITH(pcre-regex,
 [  --with-pcre-regex[=DIR] Include Perl Compatible Regular Expressions support],[
   if test "$withval" = "yes"; then
-    EXTRA_LIBS="-Lext/pcre/pcrelib -lpcre $EXTRA_LIBS"
+    EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
     PCRE_SUBDIR="pcrelib"
     AC_DEFINE(HAVE_PCRE, 1)
     AC_MSG_RESULT(yes)
@@ -17,7 +17,7 @@ AC_ARG_WITH(pcre-regex,
     AC_MSG_RESULT(no)
   fi
 ],[
-  EXTRA_LIBS="-Lext/pcre/pcrelib -lpcre $EXTRA_LIBS"
+  EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
   PCRE_SUBDIR="pcrelib"
   AC_DEFINE(HAVE_PCRE, 1)
   AC_MSG_RESULT(yes)
index 2f25c8680320c2f21f494d002e66b00889ae9999..e2a903178fe0586279496dd5ef7247bed94158c2 100644 (file)
@@ -8,7 +8,7 @@ AC_MSG_CHECKING(whether to include PCRE support)
 AC_ARG_WITH(pcre-regex,
 [  --with-pcre-regex[=DIR] Include Perl Compatible Regular Expressions support],[
   if test "$withval" = "yes"; then
-    EXTRA_LIBS="-Lext/pcre/pcrelib -lpcre $EXTRA_LIBS"
+    EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
     PCRE_SUBDIR="pcrelib"
     AC_DEFINE(HAVE_PCRE, 1)
     AC_MSG_RESULT(yes)
@@ -17,7 +17,7 @@ AC_ARG_WITH(pcre-regex,
     AC_MSG_RESULT(no)
   fi
 ],[
-  EXTRA_LIBS="-Lext/pcre/pcrelib -lpcre $EXTRA_LIBS"
+  EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
   PCRE_SUBDIR="pcrelib"
   AC_DEFINE(HAVE_PCRE, 1)
   AC_MSG_RESULT(yes)
index 97af485ce965d5f4a4279eaa405fce123a984684..5712113c965e6f6b5c43ecc37f45a9ce0f36f141 100644 (file)
@@ -74,6 +74,12 @@ SAPI_API void sapi_startup(sapi_module_struct *sf)
 }
 
 
+SAPI_API void sapi_shutdown()
+{
+       zend_hash_destroy(&known_post_content_types);
+}
+
+
 static void sapi_free_header(sapi_header_struct *sapi_header)
 {
        efree(sapi_header->header);
@@ -167,6 +173,9 @@ SAPI_API void sapi_activate(SLS_D)
        if (SG(server_context)) {
                if (SG(request_info).request_method 
                        && !strcmp(SG(request_info).request_method, "POST")) {
+                       if (!SG(request_info).content_type) {
+                               sapi_module.sapi_error(E_COMPILE_ERROR, "No content-type in POST request");
+                       }
                        sapi_read_post_data(SLS_C);
                }
                SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
@@ -291,4 +300,4 @@ SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_conte
 SAPI_API void sapi_unregister_post_reader(sapi_post_content_type_reader *post_content_type_reader)
 {
        zend_hash_del(&known_post_content_types, post_content_type_reader->content_type, post_content_type_reader->content_type_len+1);
-}
\ No newline at end of file
+}
index aba13d1b60988a14b58e82c45c43cace1f33a0b1..f7eea421f1a70b46c93955872ecef1a067561457 100644 (file)
@@ -7,6 +7,9 @@ SAPI_POST_READER_FUNC(rfc1867_post_reader)
        char input_buffer[FILE_UPLOAD_INPUT_BUFFER_SIZE];
        uint read_bytes;
 
+       sapi_module.sapi_error(E_COMPILE_ERROR, "File upload is not yet supported");
+       return;
+
        boundary = strstr(content_type_dup, "boundary");
        if (!boundary || !(boundary=strchr(boundary, '='))) {
                sapi_module.sapi_error(E_COMPILE_ERROR, "Missing boundary in multipart/form-data POST data");
index 6adee9f3c543c2306615ff2dfb3d6b8ed2e288fe..73c27ba7172d0c50a8fd5a99c3dc42c9dcca28bf 100644 (file)
@@ -208,7 +208,9 @@ static void init_request_info(SLS_D)
        SG(request_info).path_translated = r->filename;
        SG(request_info).request_uri = r->uri;
        SG(request_info).request_method = (char *)r->method;
+       printf("Obtaining content type...\n");
        SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
+       printf("Obtained content type:  %s\n", SG(request_info).content_type);
        SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
 
        if (r->headers_in) {
@@ -238,6 +240,9 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
        int fd, retval;
        SLS_FETCH();
 
+       if (setjmp(EG(bailout))!=0) {
+               return OK;
+       }
        /* We don't accept OPTIONS requests, but take everything else */
        if (r->method_number == M_OPTIONS) {
                r->allowed |= (1 << METHODS) - 1;
@@ -291,12 +296,13 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
        hard_timeout("send", r);
 
        SG(server_context) = r;
-       init_request_info(SLS_C);
        
        php_save_umask();
        chdir_file(filename);
        add_common_vars(r);
        add_cgi_vars(r);
+
+       init_request_info(SLS_C);
        apache_php_module_main(r, fd, display_source_mode SLS_CC);
 
        /* Done, restore umask, turn off timeout, close file and return */
@@ -382,6 +388,7 @@ int php_xbithack_handler(request_rec * r)
 void php_init_handler(server_rec *s, pool *p)
 {
        register_cleanup(p, NULL, php_module_shutdown, php_module_shutdown_for_exec);
+       sapi_startup(&sapi_module);
        php_module_startup(&sapi_module);
 #if MODULE_MAGIC_NUMBER >= 19980527
        ap_add_version_component("PHP/" PHP_VERSION);