Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Added support for unknown POST content types (Zeev)

- Introduce the convert_to_*_ex() API in strlen()
  • Loading branch information...
commit 98d95dd88eec996ad2608b357dd03bc7930b3fb4 1 parent 52e769d
@zsuraski zsuraski authored
View
1  ChangeLog
@@ -2,6 +2,7 @@ PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? 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)
View
8 ChangeLog.TODO
@@ -35,12 +35,6 @@ March 1 1999, Version 3.0.7
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 @@ March 1 1999, Version 3.0.7
- 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
View
4 cgi_main.c
@@ -143,7 +143,9 @@ static sapi_module_struct sapi_module = {
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
};
View
8 ext/standard/string.c
@@ -82,13 +82,13 @@ PHP_FUNCTION(bin2hex)
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);
}
/* }}} */
View
48 main/SAPI.c
@@ -41,7 +41,6 @@ SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
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_error)(int error_type, const char *message, ...);
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 @@ static void sapi_read_post_data(SLS_D)
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 @@ static void sapi_read_post_data(SLS_D)
}
}
- 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 @@ SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
}
}
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_send_headers()
}
+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 @@ SAPI_API void sapi_unregister_post_reader(sapi_post_content_type_reader *post_co
{
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;
+}
+
View
7 main/SAPI.h
@@ -63,6 +63,7 @@ typedef struct {
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 void sapi_deactivate(SLS_D);
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 @@ struct _sapi_module_struct {
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);
};
@@ -157,4 +162,6 @@ struct _sapi_module_struct {
SAPI_POST_READER_FUNC(sapi_read_standard_form_data);
+#define STANDARD_SAPI_MODULE_PROPERTIES NULL
+
#endif /* _NEW_SAPI_H */
View
6 main/config.w32.h
@@ -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
View
3  main/main.c
@@ -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 @@ int php_module_startup(sapi_module_struct *sf)
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");
View
11 main/php_content_types.c
@@ -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;
}
View
2  main/rfc1867.c
@@ -253,7 +253,7 @@ SAPI_POST_READER_FUNC(rfc1867_post_reader)
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;
}
View
4 mod_php4.c
@@ -193,7 +193,9 @@ sapi_module_struct sapi_module = {
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
};
View
54 php4dll.dsp
@@ -384,6 +384,15 @@ SOURCE=.\ext\odbc\php_odbc.c
# 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 @@ SOURCE=.\regex\regfree.c
# 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"
View
92 php4dllts.dsp
@@ -392,6 +392,15 @@ SOURCE=.\ext\odbc\php_odbc.c
# 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\uniqid.h
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"
@@ -642,6 +676,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"
Please sign in to comment.
Something went wrong with that request. Please try again.