hirokawa Sun Oct 26 02:47:25 2003 EDT
Modified files: (Branch: PHP_4_3)
/php-src/main rfc1867.c
Log:
revert my previous patch.
Index: php-src/main/rfc1867.c
diff -u php-src/main/rfc1867.c:1.122.2.13 php-src/main/rfc1867.c:1.122.2.14
--- php-src/main/rfc1867.c:1.122.2.13 Sat Oct 25 06:30:51 2003
+++ php-src/main/rfc1867.c Sun Oct 26 02:47:24 2003
@@ -16,7 +16,7 @@
| Jani Taskinen <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: rfc1867.c,v 1.122.2.13 2003/10/25 10:30:51 hirokawa Exp $ */
+/* $Id: rfc1867.c,v 1.122.2.14 2003/10/26 07:47:24 hirokawa Exp $ */
/*
* This product includes software developed by the Apache Group
@@ -32,66 +32,11 @@
#include "php_variables.h"
#include "rfc1867.h"
-#undef DEBUG_FILE_UPLOAD
-
-
#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
#include "ext/mbstring/mbstring.h"
+#endif
-static void safe_php_register_variable(char *var, char *strval, zval
*track_vars_array, zend_bool override_protection TSRMLS_DC);
-
-#define SAFE_RETURN { \
- php_mb_flush_gpc_variables(num_vars, val_list, len_list, array_ptr TSRMLS_CC); \
- if (lbuf) efree(lbuf); \
- if (abuf) efree(abuf); \
- if (array_index) efree(array_index); \
- zend_hash_destroy(&PG(rfc1867_protected_variables)); \
- zend_llist_destroy(&header); \
- if (mbuff->boundary_next) efree(mbuff->boundary_next); \
- if (mbuff->boundary) efree(mbuff->boundary); \
- if (mbuff->buffer) efree(mbuff->buffer); \
- if (mbuff) efree(mbuff); \
- return; }
-
-void php_mb_flush_gpc_variables(int num_vars, char **val_list, int *len_list, zval
*array_ptr TSRMLS_DC)
-{
- int i;
- if (php_mb_encoding_translation(TSRMLS_C)) {
- if (num_vars > 0 &&
- php_mb_gpc_encoding_detector(val_list, len_list, num_vars,
NULL TSRMLS_CC) == SUCCESS) {
- php_mb_gpc_encoding_converter(val_list, len_list, num_vars,
NULL, NULL TSRMLS_CC);
- }
- for (i=0; i<num_vars; i+=2){
- safe_php_register_variable(val_list[i], val_list[i+1],
array_ptr, 0 TSRMLS_CC);
- efree(val_list[i]);
- efree(val_list[i+1]);
- }
- efree(val_list);
- efree(len_list);
- }
-}
-
-void php_mb_gpc_stack_variable(char *param, char *value, char ***pval_list, int
**plen_list, int *num_vars, int *num_vars_max TSRMLS_DC)
-{
- char **val_list=*pval_list;
- int *len_list=*plen_list;
-
- if (*num_vars>=*num_vars_max){
- (*num_vars_max) += 16;
- *pval_list = (char **)erealloc(val_list, *num_vars_max*sizeof(char *));
- *plen_list = (int *)erealloc(len_list, *num_vars_max*sizeof(int));
- val_list=*pval_list;
- len_list=*plen_list;
- }
- val_list[*num_vars] = (char *)estrdup(param);
- len_list[*num_vars] = strlen(param);
- (*num_vars)++;
- val_list[*num_vars] = (char *)estrdup(value);
- len_list[*num_vars] = strlen(value);
- (*num_vars)++;
-}
-
-#else
+#undef DEBUG_FILE_UPLOAD
#define SAFE_RETURN { \
if (lbuf) efree(lbuf); \
@@ -105,7 +50,6 @@
if (mbuff) efree(mbuff); \
return; }
-#endif
/* The longest property name we use in an uploaded file array */
#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]")
@@ -602,8 +546,7 @@
#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
if (php_mb_encoding_translation(TSRMLS_C)) {
- int len=strlen(str);
- php_mb_gpc_encoding_detector(&str, &len, 1, NULL TSRMLS_CC);
+ php_mb_gpc_encoding_detector(str, strlen(str), NULL TSRMLS_CC);
}
#endif
@@ -757,8 +700,7 @@
FILE *fp;
zend_llist header;
#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
- int str_len = 0, num_vars = 0, num_vars_max = 2*10+1, *len_list = NULL;
- char **val_list = NULL;
+ int str_len=0;
#endif
if (SG(request_info).content_length > SG(post_max_size)) {
@@ -809,12 +751,6 @@
INIT_PZVAL(http_post_files);
PG(http_globals)[TRACK_VARS_FILES] = http_post_files;
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
- if (php_mb_encoding_translation(TSRMLS_C)) {
- val_list = (char **)ecalloc(num_vars_max, sizeof(char *));
- len_list = (int *)ecalloc(num_vars_max, sizeof(int));
- }
-#endif
zend_llist_init(&header, sizeof(mime_header_entry), (llist_dtor_func_t)
php_free_hdr_entry, 0);
while (!multipart_buffer_eof(mbuff TSRMLS_CC))
@@ -876,14 +812,13 @@
#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
if (php_mb_encoding_translation(TSRMLS_C)) {
- php_mb_gpc_stack_variable(param, value,
&val_list, &len_list,
-
&num_vars, &num_vars_max TSRMLS_CC);
- } else {
- safe_php_register_variable(param, value,
array_ptr, 0 TSRMLS_CC);
+ if (php_mb_gpc_encoding_detector(value,
strlen(value), NULL TSRMLS_CC) == SUCCESS) {
+ str_len = strlen(value);
+ php_mb_gpc_encoding_converter(&value ,
&str_len, NULL, NULL TSRMLS_CC);
+ }
}
-#else
- safe_php_register_variable(param, value, array_ptr, 0
TSRMLS_CC);
#endif
+ safe_php_register_variable(param, value, array_ptr, 0
TSRMLS_CC);
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
max_file_size = atol(value);
}
@@ -1009,15 +944,11 @@
#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
if (php_mb_encoding_translation(TSRMLS_C)) {
- val_list[num_vars] = filename;
- len_list[num_vars] = strlen(filename);
- num_vars++;
- if(php_mb_gpc_encoding_detector(val_list, len_list,
num_vars, NULL TSRMLS_CC) == SUCCESS) {
+ if(php_mb_gpc_encoding_detector(filename,
strlen(filename), NULL TSRMLS_CC) == SUCCESS) {
str_len = strlen(filename);
- php_mb_gpc_encoding_converter(&filename,
&str_len, 1, NULL, NULL TSRMLS_CC);
+ php_mb_gpc_encoding_converter(&filename,
&str_len, NULL, NULL TSRMLS_CC);
}
s = php_mb_strrchr(filename, '\\' TSRMLS_CC);
- num_vars--;
} else {
s = strrchr(filename, '\\');
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php