[PHP4BETA] CVS update: php4

From: Date: Tue, 25 May 1999 22:28:24 +0000
Subject: [PHP4BETA] CVS update: php4
Groups: php.version4 
Request: Send a blank email to php-version4+get-1055@lists.php.net to get a copy of this message
Date: Tuesday May 25, 1999 @ 18:28 Author: zeev Update of /repository/php4 In directory php:/tmp/cvs-serv7783 Modified Files: SAPI.c SAPI.h php4dllts.dsp Added Files: rfc1867.c rfc1867.h Log Message: Add container for file-upload. It's not quite implemented yet. Index: php4/SAPI.c diff -u php4/SAPI.c:1.21 php4/SAPI.c:1.22 --- php4/SAPI.c:1.21 Tue May 25 17:19:46 1999 +++ php4/SAPI.c Tue May 25 18:28:24 1999 @@ -21,6 +21,8 @@ #include "TSRM.h" #endif +#include "rfc1867.h" + #if WIN32||WINNT #define STRCASECMP stricmp #else @@ -33,7 +35,8 @@ #define DEFAULT_POST_CONTENT_TYPE "application/x-www-form-urlencoded" 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 }, + { 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 } }; @@ -80,19 +83,43 @@ #undef SAPI_POST_BLOCK_SIZE #define SAPI_POST_BLOCK_SIZE 2 + static void sapi_read_post_data(SLS_D) { sapi_post_content_type_reader *post_content_type_reader; uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); + char *p; + char oldchar=0; - zend_str_tolower(content_type, content_type_length); + /* dedicated implementation for increased performance: + * - Make the content type lowercase + * - Trim descriptive data, stay with the content-type only + */ + for (p=content_type; p<content_type+content_type_length; p++) { + switch (*p) { + case ';': + case ',': + case ' ': + content_type_length = p-content_type; + oldchar = *p; + *p = 0; + break; + default: + *p = tolower(*p); + break; + } + } 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_CORE_ERROR, "Unsupported content type: '%s'", content_type); + sapi_module.sapi_error(E_COMPILE_ERROR, "Unsupported content type: '%s'", content_type); return; + } + if (oldchar) { + *(p-1) = oldchar; } - post_content_type_reader->post_reader(SLS_C); + post_content_type_reader->post_reader(content_type SLS_CC); + efree(content_type); } Index: php4/SAPI.h diff -u php4/SAPI.h:1.15 php4/SAPI.h:1.16 --- php4/SAPI.h:1.15 Tue May 25 17:19:46 1999 +++ php4/SAPI.h Tue May 25 18:28:24 1999 @@ -67,13 +67,6 @@ } sapi_globals_struct; -typedef struct _sapi_post_content_type_reader { - char *content_type; - uint content_type_len; - void (*post_reader)(SLS_D); -} sapi_post_content_type_reader; - - #ifdef ZTS # define SLS_D sapi_globals_struct *sapi_globals # define SLS_DC , SLS_D @@ -92,6 +85,12 @@ extern SAPI_API sapi_globals_struct sapi_globals; #endif +typedef struct _sapi_post_content_type_reader { + char *content_type; + uint content_type_len; + void (*post_reader)(char *content_type_dup SLS_DC); +} sapi_post_content_type_reader; + SAPI_API void sapi_startup(sapi_module_struct *sf); SAPI_API void sapi_activate(SLS_D); @@ -134,6 +133,6 @@ #define SAPI_DEFAULT_CONTENT_TYPE "Content-Type: text/html" -#define SAPI_POST_READER_FUNC(post_reader) void post_reader(SLS_D) +#define SAPI_POST_READER_FUNC(post_reader) void post_reader(char *content_type_dup SLS_DC) #endif /* _NEW_SAPI_H */ Index: php4/php4dllts.dsp diff -u php4/php4dllts.dsp:1.7 php4/php4dllts.dsp:1.8 --- php4/php4dllts.dsp:1.7 Thu May 20 08:06:43 1999 +++ php4/php4dllts.dsp Tue May 25 18:28:24 1999 @@ -69,7 +69,7 @@ # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libzend" /I "." /I "regex\\" /I "..\tsrm" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libzend" /I "." /I "regex\\" /I "..\tsrm" /I "..\bindlib_w32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PHP4DLLTS_EXPORTS" /D "MSVC5" /D "PHP_EXPORTS" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "SAPI_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x40d /d "NDEBUG" @@ -143,6 +143,10 @@ # End Source File # Begin Source File +SOURCE=.\rfc1867.c +# End Source File +# Begin Source File + SOURCE=.\safe_mode.c # End Source File # Begin Source File @@ -220,6 +224,10 @@ # Begin Source File SOURCE=.\request_info.h +# End Source File +# Begin Source File + +SOURCE=.\rfc1867.h # End Source File # Begin Source File -- PHP 4 Beta

« previous php.version4 (#1055) next »