Skip to content

Commit 69aed1b

Browse files
committed
Merge branch 'master' of github.com:/ralflang/php-src
merged pull request #372: >2G uploads by Ralf Lang #372
2 parents 7ca7ea8 + d80a910 commit 69aed1b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

main/SAPI.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "zend_operators.h"
2828
#ifdef PHP_WIN32
2929
#include "win95nt.h"
30+
#include "win32/php_stdint.h"
3031
#endif
3132
#include <sys/stat.h>
3233

@@ -82,7 +83,7 @@ typedef struct {
8283
char *post_data, *raw_post_data;
8384
char *cookie_data;
8485
long content_length;
85-
uint post_data_length, raw_post_data_length;
86+
int64_t post_data_length, raw_post_data_length;
8687

8788
char *path_translated;
8889
char *request_uri;
@@ -119,7 +120,7 @@ typedef struct _sapi_globals_struct {
119120
void *server_context;
120121
sapi_request_info request_info;
121122
sapi_headers_struct sapi_headers;
122-
int read_post_bytes;
123+
int64_t read_post_bytes;
123124
unsigned char headers_sent;
124125
struct stat global_stat;
125126
char *default_mimetype;

main/rfc1867.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
#include "rfc1867.h"
3535
#include "ext/standard/php_string.h"
3636

37+
#if defined(PHP_WIN32) && !defined(HAVE_ATOLL)
38+
# define atoll(s) _atoi64(s)
39+
#endif
40+
3741
#define DEBUG_FILE_UPLOAD ZEND_DEBUG
3842

3943
static int dummy_encoding_translation(TSRMLS_D)
@@ -676,8 +680,9 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
676680
{
677681
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
678682
char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
679-
int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
680-
int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
683+
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
684+
int64_t total_bytes = 0, max_file_size = 0;
685+
int skip_upload = 0, anonindex = 0, is_anonymous;
681686
zval *http_post_files = NULL;
682687
HashTable *uploaded_files = NULL;
683688
multipart_buffer *mbuff;
@@ -898,7 +903,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
898903
}
899904

900905
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
901-
max_file_size = atol(value);
906+
max_file_size = atoll(value);
902907
}
903908

904909
efree(param);

sapi/cgi/cgi_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
508508
uint read_bytes = 0;
509509
int tmp_read_bytes;
510510

511-
count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
511+
count_bytes = MIN(count_bytes, SG(request_info).content_length - SG(read_post_bytes));
512512
while (read_bytes < count_bytes) {
513513
tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
514514
if (tmp_read_bytes <= 0) {

0 commit comments

Comments
 (0)