cvs: /php4 ChangeLog ChangeLog.TODO SAPI.c SAPI.h cgi_main.c config.w32.h main.c mod_php4.c php4dll.dsp php4dllts.dsp php_content_types.c rfc1867.c
/php4/ext/standard string.c /php4/php4isapi php4isapi.c
| From: | Zeev Suraski | Date: | Thu, 16 Sep 1999 23:18:18 +0000 |
| Subject: | cvs: /php4 ChangeLog ChangeLog.TODO SAPI.c SAPI.h cgi_main.c config.w32.h main.c mod_php4.c php4dll.dsp php4dllts.dsp php_content_types.c rfc1867.c /php4/ext/standard string.c /php4/php4isapi php4isapi.c |
||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4544@lists.php.net to get a copy of this message | ||
zeev Thu Sep 16 19:18:18 1999 EDT
Modified files:
/php4 ChangeLog ChangeLog.TODO SAPI.c SAPI.h cgi_main.c
config.w32.h main.c mod_php4.c php4dll.dsp php4dllts.dsp
php_content_types.c rfc1867.c
/php4/ext/standard string.c
/php4/php4isapi php4isapi.c
Log:
- Added support for unknown POST content types (Zeev)
- Introduce the convert_to_*_ex() API in strlen()
Index: php4/ChangeLog
diff -u php4/ChangeLog:1.110 php4/ChangeLog:1.111
--- php4/ChangeLog:1.110 Thu Sep 16 09:00:06 1999
+++ php4/ChangeLog Thu Sep 16 19:18:13 1999
@@ -2,6 +2,7 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 1999, Version 4.0 Beta 3
+- Added support for unknown POST content types (Zeev)
- Added "wddx" serialization handler for session module (Sascha)
(automatically enabled, if you compile with --with-wddx)
- Fixed deserializing objects (Thies)
Index: php4/ChangeLog.TODO
diff -u php4/ChangeLog.TODO:1.9 php4/ChangeLog.TODO:1.10
--- php4/ChangeLog.TODO:1.9 Tue Jul 20 15:11:31 1999
+++ php4/ChangeLog.TODO Thu Sep 16 19:18:15 1999
@@ -35,12 +35,6 @@
variables.
- Clean up apxs build
- Add INSTALL.REDHAT file to walk RedHat users through the install
-- Added optional second argument to mysql_fetch_array(); MYSQL_ASSOC will
- cause the resulting array to contain the associative indices only,
- MYSQL_NUM will cause the array to contain the numeric indices only (like
- mysql_fetch_row()) and MYSQL_BOTH would cause them both to be defined
- (default).
-- Backport the Zend debugging memory manager into the PHP 3.0.x tree.
- Add function_exists() function.
- Add another version of WDDX module
(we need to pick a single implementation here)
@@ -76,8 +70,6 @@
- Fix bug in pdf_close() function
- Add WDDX support (see http://www.wddx.org for more info)
- Add similar_text() function
-- Constructors of parent classes weren't accessible to derived classes (as
- of 3.0.6). Fixed.
- Introduce simple regex compilation cache
Index: php4/SAPI.c
diff -u php4/SAPI.c:1.30 php4/SAPI.c:1.31
--- php4/SAPI.c:1.30 Tue Sep 14 09:32:54 1999
+++ php4/SAPI.c Thu Sep 16 19:18:15 1999
@@ -41,7 +41,6 @@
static sapi_post_content_type_reader supported_post_content_types[] = {
{ DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data },
- { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, rfc1867_post_reader },
{ NULL, 0, NULL }
};
@@ -65,14 +64,11 @@
SAPI_API void sapi_startup(sapi_module_struct *sf)
{
- sapi_post_content_type_reader *post_content_type_reader=supported_post_content_types;
-
sapi_module = *sf;
zend_hash_init(&known_post_content_types, 5, NULL, NULL, 1);
- while (post_content_type_reader->content_type) {
- sapi_register_post_reader(post_content_type_reader);
- post_content_type_reader++;
- }
+
+ sapi_register_post_reader(supported_post_content_types);
+
#ifdef ZTS
sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), NULL, NULL);
#endif
@@ -100,6 +96,8 @@
char *content_type = estrndup(SG(request_info).content_type, content_type_length);
char *p;
char oldchar=0;
+ void (*post_reader_func)(char *content_type_dup SLS_DC);
+
/* dedicated implementation for increased performance:
* - Make the content type lowercase
@@ -120,14 +118,19 @@
}
}
- if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **)
&post_content_type_reader)==FAILURE) {
- sapi_module.sapi_error(E_COMPILE_ERROR, "Unsupported content type: '%s'",
content_type);
- return;
+ if (zend_hash_find(&known_post_content_types, content_type, content_type_length+1, (void **)
&post_content_type_reader)==SUCCESS) {
+ post_reader_func = post_content_type_reader->post_reader;
+ } else {
+ if (!sapi_module.default_post_reader) {
+ sapi_module.sapi_error(E_COMPILE_ERROR, "Unsupported content type: '%s'",
content_type);
+ return;
+ }
+ post_reader_func = sapi_module.default_post_reader;
}
if (oldchar) {
*(p-1) = oldchar;
}
- post_content_type_reader->post_reader(content_type SLS_CC);
+ post_reader_func(content_type SLS_CC);
efree(content_type);
}
@@ -154,6 +157,7 @@
}
}
SG(request_info).post_data[total_read_bytes] = 0; /* terminating NULL */
+ SG(request_info).post_data_length = total_read_bytes;
}
@@ -295,6 +299,20 @@
}
+SAPI_API int sapi_register_post_readers(sapi_post_content_type_reader *post_content_type_readers)
+{
+ sapi_post_content_type_reader *p=post_content_type_readers;
+
+ while (p->content_type) {
+ if (sapi_register_post_reader(p)==FAILURE) {
+ return FAILURE;
+ }
+ p++;
+ }
+ return SUCCESS;
+}
+
+
SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_content_type_reader)
{
return zend_hash_add(&known_post_content_types, post_content_type_reader->content_type,
post_content_type_reader->content_type_len+1, (void *) post_content_type_reader,
sizeof(sapi_post_content_type_reader), NULL);
@@ -305,3 +323,11 @@
{
zend_hash_del(&known_post_content_types, post_content_type_reader->content_type,
post_content_type_reader->content_type_len+1);
}
+
+
+SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(char *content_type_dup
SLS_DC))
+{
+ sapi_module.default_post_reader = default_post_reader;
+ return SUCCESS;
+}
+
Index: php4/SAPI.h
diff -u php4/SAPI.h:1.20 php4/SAPI.h:1.21
--- php4/SAPI.h:1.20 Mon Sep 13 16:03:55 1999
+++ php4/SAPI.h Thu Sep 16 19:18:15 1999
@@ -63,6 +63,7 @@
char *post_data;
char *cookie_data;
uint content_length;
+ uint post_data_length;
char *path_translated;
char *request_uri;
@@ -118,8 +119,10 @@
SAPI_API int sapi_add_header(char *header_line, uint header_line_len);
SAPI_API int sapi_send_headers();
+SAPI_API int sapi_register_post_readers(sapi_post_content_type_reader *post_content_type_readers);
SAPI_API int sapi_register_post_reader(sapi_post_content_type_reader *post_content_type_reader);
SAPI_API void sapi_unregister_post_reader(sapi_post_content_type_reader *post_content_type_reader);
+SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(char *content_type_dup
SLS_DC));
struct _sapi_module_struct {
char *name;
@@ -137,6 +140,8 @@
int (*read_post)(char *buffer, uint count_bytes SLS_DC);
char *(*read_cookies)(SLS_D);
+
+ void (*default_post_reader)(char *content_type_dup SLS_DC);
};
@@ -156,5 +161,7 @@
#define SAPI_POST_READER_FUNC(post_reader) void post_reader(char *content_type_dup SLS_DC)
SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
+
+#define STANDARD_SAPI_MODULE_PROPERTIES NULL
#endif /* _NEW_SAPI_H */
Index: php4/cgi_main.c
diff -u php4/cgi_main.c:1.30 php4/cgi_main.c:1.31
--- php4/cgi_main.c:1.30 Sat Sep 11 23:25:02 1999
+++ php4/cgi_main.c Thu Sep 16 19:18:15 1999
@@ -143,7 +143,9 @@
sapi_cgi_send_header, /* send header handler */
sapi_cgi_read_post, /* read POST data */
- sapi_cgi_read_cookies /* read Cookies */
+ sapi_cgi_read_cookies, /* read Cookies */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
};
Index: php4/config.w32.h
diff -u php4/config.w32.h:1.13 php4/config.w32.h:1.14
--- php4/config.w32.h:1.13 Tue Sep 14 16:02:47 1999
+++ php4/config.w32.h Thu Sep 16 19:18:15 1999
@@ -10,7 +10,11 @@
#define HAVE_BINDLIB 1
/* set to enable bcmath */
-#define WITH_BCMATH 0
+#define WITH_BCMATH 1
+
+/* set to enable bundled PCRE library */
+#define HAVE_BUNDLED_PCRE 1
+
/* should be added to runtime config*/
#define PHP3_URL_FOPEN 1
Index: php4/main.c
diff -u php4/main.c:1.122 php4/main.c:1.123
--- php4/main.c:1.122 Sun Sep 12 16:36:47 1999
+++ php4/main.c Thu Sep 16 19:18:15 1999
@@ -19,7 +19,7 @@
*/
-/* $Id: main.c,v 1.122 1999/09/12 20:36:47 zeev Exp $ */
+/* $Id: main.c,v 1.123 1999/09/16 23:18:15 zeev Exp $ */
#include <stdio.h>
@@ -64,6 +64,8 @@
#include "zend_highlight.h"
#include "zend_indent.h"
+#include "php_content_types.h"
+
#if USE_SAPI
#include "serverapi/sapi.h"
void *gLock;
@@ -876,6 +878,7 @@
zuv.short_tags = (unsigned char) PG(short_tags);
zuv.asp_tags = (unsigned char) PG(asp_tags);
zend_set_utility_values(&zuv);
+ php_startup_SAPI_content_types();
if (module_startup_modules() == FAILURE) {
php_printf("Unable to start modules\n");
Index: php4/mod_php4.c
diff -u php4/mod_php4.c:1.25 php4/mod_php4.c:1.26
--- php4/mod_php4.c:1.25 Sun Sep 12 20:35:03 1999
+++ php4/mod_php4.c Thu Sep 16 19:18:15 1999
@@ -17,7 +17,7 @@
| PHP 4.0 patches by Zeev Suraski <zeev@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php4.c,v 1.25 1999/09/13 00:35:03 zeev Exp $ */
+/* $Id: mod_php4.c,v 1.26 1999/09/16 23:18:15 zeev Exp $ */
#include "httpd.h"
#include "http_config.h"
@@ -193,7 +193,9 @@
NULL, /* send header handler */
sapi_apache_read_post, /* read POST data */
- sapi_apache_read_cookies /* read Cookies */
+ sapi_apache_read_cookies, /* read Cookies */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
};
Index: php4/php4dll.dsp
diff -u php4/php4dll.dsp:1.16 php4/php4dll.dsp:1.17
--- php4/php4dll.dsp:1.16 Wed Sep 15 01:42:34 1999
+++ php4/php4dll.dsp Thu Sep 16 19:18:15 1999
@@ -384,6 +384,15 @@
# Begin Source File
SOURCE=.\ext\pcre\php_pcre.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
@@ -595,22 +604,67 @@
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\chartables.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\get.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\maketables.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\pcre.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\study.c
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
# End Source File
# End Group
# Begin Group "Header Files No. 3"
Index: php4/php4dllts.dsp
diff -u php4/php4dllts.dsp:1.23 php4/php4dllts.dsp:1.24
--- php4/php4dllts.dsp:1.23 Tue Sep 14 16:02:47 1999
+++ php4/php4dllts.dsp Thu Sep 16 19:18:15 1999
@@ -392,6 +392,15 @@
# Begin Source File
SOURCE=.\ext\pcre\php_pcre.c
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
# End Source File
# Begin Source File
@@ -582,51 +591,76 @@
SOURCE=.\ext\standard\url.h
# End Source File
# End Group
-# Begin Group "Regular Expressions"
+# Begin Group "PCRE"
# PROP Default_Filter ""
-# Begin Source File
+# Begin Group "Source Files No. 3"
-SOURCE=.\regex\regcomp.c
-# End Source File
+# PROP Default_Filter ".c"
# Begin Source File
-SOURCE=.\regex\regerror.c
-# End Source File
-# Begin Source File
+SOURCE=.\ext\pcre\pcrelib\chartables.c
-SOURCE=.\regex\regexec.c
-# End Source File
-# Begin Source File
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
-SOURCE=.\regex\regfree.c
-# End Source File
-# End Group
-# Begin Group "PCRE"
+# ADD CPP /D "STATIC"
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 3"
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
-# PROP Default_Filter ".c"
-# Begin Source File
+!ENDIF
-SOURCE=.\ext\pcre\pcrelib\chartables.c
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\get.c
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\maketables.c
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\pcre.c
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
# End Source File
# Begin Source File
SOURCE=.\ext\pcre\pcrelib\study.c
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# ADD CPP /D "STATIC"
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
# End Source File
# End Group
# Begin Group "Header Files No. 3"
@@ -641,6 +675,26 @@
SOURCE=.\ext\pcre\pcrelib\pcre.h
# End Source File
# End Group
+# End Group
+# Begin Group "Regular Expressions"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\regex\regcomp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\regex\regerror.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\regex\regexec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\regex\regfree.c
+# End Source File
# End Group
# End Group
# Begin Group "Win32"
Index: php4/php_content_types.c
diff -u php4/php_content_types.c:1.1 php4/php_content_types.c:1.2
--- php4/php_content_types.c:1.1 Thu Sep 16 18:15:42 1999
+++ php4/php_content_types.c Thu Sep 16 19:18:15 1999
@@ -5,10 +5,21 @@
static sapi_post_content_type_reader php_post_content_types[] = {
{ MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, rfc1867_post_reader },
{ NULL, 0, NULL }
+};
+
+
+SAPI_POST_READER_FUNC(php_default_post_reader)
+{
+ ELS_FETCH();
+
+ sapi_read_standard_form_data(content_type_dup SLS_CC);
+ SET_VAR_STRINGL("HTTP_RAW_POST_DATA", SG(request_info).post_data,
SG(request_info).post_data_length);
}
+
int php_startup_SAPI_content_types()
{
sapi_register_post_readers(php_post_content_types);
+ sapi_register_default_post_reader(php_default_post_reader);
return SUCCESS;
}
Index: php4/rfc1867.c
diff -u php4/rfc1867.c:1.10 php4/rfc1867.c:1.11
--- php4/rfc1867.c:1.10 Sun Sep 12 19:51:12 1999
+++ php4/rfc1867.c Thu Sep 16 19:18:15 1999
@@ -15,7 +15,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.10 1999/09/12 23:51:12 zeev Exp $ */
+/* $Id: rfc1867.c,v 1.11 1999/09/16 23:18:15 zeev Exp $ */
#include <stdio.h>
#include "php.h"
@@ -253,7 +253,7 @@
sapi_read_standard_form_data(content_type_dup SLS_CC);
if (SG(request_info).post_data) {
- php_mime_split(SG(request_info).post_data, SG(request_info).content_length, boundary);
+ php_mime_split(SG(request_info).post_data, SG(request_info).post_data_length, boundary);
efree(SG(request_info).post_data);
SG(request_info).post_data = NULL;
}
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.36 php4/ext/standard/string.c:1.37
--- php4/ext/standard/string.c:1.36 Sat Sep 11 10:09:29 1999
+++ php4/ext/standard/string.c Thu Sep 16 19:18:15 1999
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.36 1999/09/11 14:09:29 zeev Exp $ */
+/* $Id: string.c,v 1.37 1999/09/16 23:18:15 zeev Exp $ */
/* Synced with php3 revision 1.193 1999-06-16 [ssb] */
@@ -82,13 +82,13 @@
Get string length */
PHP_FUNCTION(strlen)
{
- pval *str;
+ pval **str;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
+ if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) {
WRONG_PARAM_COUNT;
}
- convert_to_string(str);
- RETVAL_LONG(str->value.str.len);
+ convert_to_string_ex(str);
+ RETVAL_LONG((*str)->value.str.len);
}
/* }}} */
Index: php4/php4isapi/php4isapi.c
diff -u php4/php4isapi/php4isapi.c:1.27 php4/php4isapi/php4isapi.c:1.28
--- php4/php4isapi/php4isapi.c:1.27 Sun Sep 12 17:07:53 1999
+++ php4/php4isapi/php4isapi.c Thu Sep 16 19:18:15 1999
@@ -285,7 +285,9 @@
NULL, /* send header handler */
sapi_isapi_read_post, /* read POST data */
- sapi_isapi_read_cookies /* read Cookies */
+ sapi_isapi_read_cookies, /* read Cookies */
+
+ STANDARD_SAPI_MODULE_PROPERTIES
};