php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #44522
Patch uploads_larger_than_2g_HEAD_v2 revision 2012-03-26 03:59 UTC by jason at infininull dot com
Patch uploads_larger_than_2g_HEAD revision 2012-03-26 03:46 UTC by jason at infininull dot com
Patch uploads_larger_than_2g revision 2012-03-24 18:41 UTC by jason at infininull dot com

Patch uploads_larger_than_2g for *Web Server problem Bug #44522

Patch version 2012-03-24 18:41 UTC

Return to Bug #44522 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: jason@infininull.com

Request #44522	http upload max_limits and file above 2GB

https://bugs.php.net/bug.php?id=44522
Index: php5-5.3.5/Zend/zend_operators.c
===================================================================
--- php5-5.3.5.orig/Zend/zend_operators.c	2012-03-23 19:13:57.726182168 -0400
+++ php5-5.3.5/Zend/zend_operators.c	2012-03-23 19:14:22.044601798 -0400
@@ -45,9 +45,9 @@
 
 #define TYPE_PAIR(t1,t2) (((t1) << 4) | (t2))
 
-ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */
+ZEND_API long zend_atoi(const char *str, int str_len) /* {{{ */
 {
-	int retval;
+	long retval;
 
 	if (!str_len) {
 		str_len = strlen(str);
Index: php5-5.3.5/Zend/zend_operators.h
===================================================================
--- php5-5.3.5.orig/Zend/zend_operators.h	2012-03-23 19:13:57.706183467 -0400
+++ php5-5.3.5/Zend/zend_operators.h	2012-03-23 19:14:22.044601798 -0400
@@ -321,7 +321,7 @@
 ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
 ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
 
-ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API long zend_atoi(const char *str, int str_len);
 ZEND_API long zend_atol(const char *str, int str_len);
 
 ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
Index: php5-5.3.5/main/SAPI.h
===================================================================
--- php5-5.3.5.orig/main/SAPI.h	2012-03-23 19:13:57.696184117 -0400
+++ php5-5.3.5/main/SAPI.h	2012-03-23 19:14:22.044601798 -0400
@@ -82,7 +82,7 @@
 	char *post_data, *raw_post_data;
 	char *cookie_data;
 	long content_length;
-	uint post_data_length, raw_post_data_length;
+	uint IGNORE_post_data_length, IGNORE_raw_post_data_length;
 
 	char *path_translated;
 	char *request_uri;
@@ -113,6 +113,7 @@
 	int argc;
 	char **argv;
 	int proto_num;
+	long post_data_length, raw_post_data_length;
 } sapi_request_info;
 
 
@@ -120,7 +121,7 @@
 	void *server_context;
 	sapi_request_info request_info;
 	sapi_headers_struct sapi_headers;
-	int read_post_bytes;
+	long read_post_bytes;
 	unsigned char headers_sent;
 	struct stat global_stat;
 	char *default_mimetype;
Index: php5-5.3.5/sapi/apache/mod_php5.c
===================================================================
--- php5-5.3.5.orig/sapi/apache/mod_php5.c	2012-03-23 19:13:57.686184767 -0400
+++ php5-5.3.5/sapi/apache/mod_php5.c	2012-03-23 19:14:22.044601798 -0400
@@ -533,7 +533,7 @@
 	SG(request_info).request_uri = r->uri;
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 	SG(request_info).proto_num = r->proto_num;
 
Index: php5-5.3.5/sapi/apache2filter/sapi_apache2.c
===================================================================
--- php5-5.3.5.orig/sapi/apache2filter/sapi_apache2.c	2012-03-23 19:13:57.656186717 -0400
+++ php5-5.3.5/sapi/apache2filter/sapi_apache2.c	2012-03-23 19:14:22.044601798 -0400
@@ -420,7 +420,7 @@
 	efree(content_type);
 
 	content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	
 	apr_table_unset(f->r->headers_out, "Content-Length");
 	apr_table_unset(f->r->headers_out, "Last-Modified");
Index: php5-5.3.5/sapi/apache2handler/sapi_apache2.c
===================================================================
--- php5-5.3.5.orig/sapi/apache2handler/sapi_apache2.c	2012-03-23 19:13:57.666186067 -0400
+++ php5-5.3.5/sapi/apache2handler/sapi_apache2.c	2012-03-23 19:14:22.044601798 -0400
@@ -484,7 +484,7 @@
 	r->no_local_copy = 1;
 
 	content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 
 	apr_table_unset(r->headers_out, "Content-Length");
 	apr_table_unset(r->headers_out, "Last-Modified");
Index: php5-5.3.5/sapi/apache_hooks/mod_php5.c
===================================================================
--- php5-5.3.5.orig/sapi/apache_hooks/mod_php5.c	2012-03-23 19:13:57.626188667 -0400
+++ php5-5.3.5/sapi/apache_hooks/mod_php5.c	2012-03-23 19:14:22.044601798 -0400
@@ -587,7 +587,7 @@
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).proto_num = r->proto_num;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 
 	if (r->headers_in) {
Index: php5-5.3.5/sapi/cgi/cgi_main.c
===================================================================
--- php5-5.3.5.orig/sapi/cgi/cgi_main.c	2012-03-23 19:13:57.646187367 -0400
+++ php5-5.3.5/sapi/cgi/cgi_main.c	2012-03-23 19:14:22.044601798 -0400
@@ -491,7 +491,7 @@
 	uint read_bytes = 0;
 	int tmp_read_bytes;
 
-	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	count_bytes = MIN(count_bytes,  SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
 		if (fcgi_is_fastcgi()) {
 			fcgi_request *request = (fcgi_request*) SG(server_context);
@@ -1350,7 +1350,7 @@
 		/* FIXME - Work out proto_num here */
 		SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING")-1 TSRMLS_CC);
 		SG(request_info).content_type = (content_type ? content_type : "" );
-		SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+		SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 
 		/* The CGI RFC allows servers to pass on unvalidated Authorization data */
 		auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION", sizeof("HTTP_AUTHORIZATION")-1 TSRMLS_CC);
Index: php5-5.3.5/main/rfc1867.c
===================================================================
--- php5-5.3.5.orig/main/rfc1867.c	2012-03-23 19:13:51.326598046 -0400
+++ php5-5.3.5/main/rfc1867.c	2012-03-23 19:15:23.330618830 -0400
@@ -764,8 +764,9 @@
 {
 	char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
 	char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
-	int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
-	int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
+	int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
+	long total_bytes = 0, max_file_size = 0;
+	int skip_upload = 0, anonindex = 0, is_anonymous;
 	zval *http_post_files = NULL;
 	HashTable *uploaded_files = NULL;
 #if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 15:02:26 2014 UTC