CVS update: php3/functions

From: Date: Sat, 15 May 1999 21:11:05 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-5648@lists.php.net to get a copy of this message
Date: Saturday May 15, 1999 @ 17:11 Author: rasmus Update of /repository/php3/functions In directory php:/tmp/cvs-serv23927/functions Modified Files: post.c Log Message: Clean up, test and document the PUT method support code Index: php3/functions/post.c diff -u php3/functions/post.c:1.117 php3/functions/post.c:1.118 --- php3/functions/post.c:1.117 Tue May 11 08:11:41 1999 +++ php3/functions/post.c Sat May 15 17:11:05 1999 @@ -52,7 +52,6 @@ * This copies the uploaded file to a temporary file. */ static void php3_getput(void) { - char *buf = NULL; #if MODULE_MAGIC_NUMBER > 19961007 char upload_buffer[BUFSIZ]; #endif @@ -64,7 +63,7 @@ length = GLOBAL(request_info).content_length; if (length > php3_ini.upload_max_filesize) { php3_error(E_WARNING, "Max file size of %ld bytes exceeded - temporary file not saved", php3_ini.upload_max_filesize); - SET_VAR_STRING("PHP_UPLOADED_FILE_NAME", estrdup("none")); + SET_VAR_STRING("PHP_PUT_FILENAME", estrdup("none")); return; } fn = tempnam(php3_ini.upload_tmp_dir, "php"); @@ -102,21 +101,15 @@ cnt = 0; do { #if APACHE -/* - FIXME ??? The following code makes absolutely no sense. upload_buffer is defined - but never used, and data is being read into buf which would cause a - seg-fault since no memory has been allocated for it, and on top of that - this buf is never used for anything. -*/ char upload_buffer[BUFSIZ]; - bytes = read_client_block(php3_rqst, buf + cnt, min(length - cnt,BUFSIZ)); + bytes = read_client_block(php3_rqst, upload_buffer + cnt, min(length - cnt,BUFSIZ)); #endif #if CGI_BINARY - bytes = fread(buf + cnt, 1, ((length-cnt)<BUFSIZ)?length-cnt:BUFSIZ, stdin); + bytes = fread(upload_buffer + cnt, 1, ((length-cnt)<BUFSIZ)?length-cnt:BUFSIZ, stdin); #endif #if USE_SAPI - bytes = GLOBAL(sapi_rqst)->readclient(GLOBAL(sapi_rqst)->scid,buf + cnt, 1, min(length - cnt,BUFSIZ)); + bytes = GLOBAL(sapi_rqst)->readclient(GLOBAL(sapi_rqst)->scid,upload_buffer + cnt, 1, min(length - cnt,BUFSIZ)); #endif cnt += bytes; } while (bytes && cnt < length); @@ -126,7 +119,7 @@ if (bytes < length) { php3_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, length); } - SET_VAR_STRING("PHP_UPLOADED_FILE_NAME", estrdup(fn)); + SET_VAR_STRING("PHP_PUT_FILENAME", estrdup(fn)); php3_list_do_insert(&GLOBAL(list),fn,GLOBAL(le_uploads)); /* Tell PHP about the file so the destructor can unlink it later */ } -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5648) next »