[PHP4BETA] CVS update: php4/php4isapi
| From: | andi | Date: | Sun, 02 May 1999 18:07:42 +0000 |
| Subject: | [PHP4BETA] CVS update: php4/php4isapi | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-619@lists.php.net to get a copy of this message | ||
Date: Sunday May 2, 1999 @ 14:07
Author: andi
Update of /repository/php4/php4isapi
In directory php:/tmp/cvs-serv13198/php4isapi
Modified Files:
php4isapi.c php4isapi.def
Log Message:
- Make ISAPI hook in as an extension too.
- Some work on moving stuff to SAPI.
Index: php4/php4isapi/php4isapi.c
diff -u php4/php4isapi/php4isapi.c:1.2 php4/php4isapi/php4isapi.c:1.3
--- php4/php4isapi/php4isapi.c:1.2 Mon Apr 26 10:00:50 1999
+++ php4/php4isapi/php4isapi.c Sun May 2 14:07:42 1999
@@ -1,6 +1,7 @@
#include <windows.h>
#include <httpext.h>
#include <httpfilt.h>
+#include <httpext.h>
#include "php.h"
#include "main.h"
#include "SAPI.h"
@@ -10,30 +11,35 @@
static int zend_isapi_ub_write(const char *str, uint str_length)
{
DWORD num_bytes = str_length;
- PHTTP_FILTER_CONTEXT pfc;
+ LPEXTENSION_CONTROL_BLOCK ecb;
SLS_FETCH();
- pfc = (PHTTP_FILTER_CONTEXT) SG(server_context);
- pfc->WriteClient(pfc, (char *) str, &num_bytes, HSE_IO_SYNC );
+ ecb = (LPEXTENSION_CONTROL_BLOCK) SG(server_context);
+ ecb->WriteClient(ecb->ConnID, (char *) str, &num_bytes, HSE_IO_SYNC );
return num_bytes;
}
-static sapi_functions_struct sapi_functions = {
- zend_isapi_ub_write
+static sapi_module_struct sapi_module = {
+ "PHP Language", /* name */
+
+ php_module_startup, /* startup */
+ php_module_shutdown_wrapper, /* shutdown */
+
+ zend_isapi_ub_write, /* unbuffered write */
};
-BOOL WINAPI GetFilterVersion (PHTTP_FILTER_VERSION pFilterVersion)
+BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion)
{
pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION;
- strcpy (pFilterVersion->lpszFilterDesc, "PHP Language");
+ strcpy(pFilterVersion->lpszFilterDesc, sapi_module.name);
pFilterVersion->dwFlags= (SF_NOTIFY_ORDER_HIGH |
SF_NOTIFY_SECURE_PORT |
SF_NOTIFY_NONSECURE_PORT |
SF_NOTIFY_URL_MAP);
-
- php_module_startup(&sapi_functions);
+ tsrm_startup(1,1,0);
+ sapi_startup(&sapi_module);
return TRUE;
}
@@ -42,7 +48,6 @@
{
SLS_FETCH();
- SG(server_context) = pfc;
switch (notificationType) {
case SF_NOTIFY_NONSECURE_PORT:
OutputDebugString("Non secure port\n");
@@ -50,21 +55,62 @@
case SF_NOTIFY_SECURE_PORT:
OutputDebugString("Secure port\n");
break;
- case SF_NOTIFY_URL_MAP: {
- PHTTP_FILTER_URL_MAP UrlMap = (PHTTP_FILTER_URL_MAP) pvNotification;
- zend_file_handle primary_file;
- CLS_FETCH();
- ELS_FETCH();
- PLS_FETCH();
-
- php_request_startup(CLS_C ELS_CC PLS_CC);
- primary_file.filename = UrlMap->pszPhysicalPath;
- primary_file.type = ZEND_HANDLE_FILENAME;
- php_execute_script(&primary_file CLS_CC ELS_CC PLS_CC);
- php_request_shutdown(NULL);
- return SF_STATUS_REQ_FINISHED_KEEP_CONN;
- }
+ case SF_NOTIFY_URL_MAP:
+ OutputDebugString("URL Map\n");
break;
}
return SF_STATUS_REQ_NEXT_NOTIFICATION;
+}
+
+
+static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+ sapi_globals->request_info.path_translated = lpECB->lpszPathTranslated;
+}
+
+
+BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer)
+{
+ pVer->dwExtensionVersion = HSE_VERSION;
+ lstrcpyn(pVer->lpszExtensionDesc, sapi_module.name, HSE_MAX_EXT_DLL_NAME_LEN);
+ if (sapi_module.startup) {
+ sapi_module.startup(&sapi_module);
+ }
+ return TRUE;
+}
+
+
+BOOL WINAPI TerminateExtension(DWORD dwFlags)
+{
+ if (dwFlags & HSE_TERM_MUST_UNLOAD) {
+ if (sapi_module.shutdown) {
+ sapi_module.shutdown(&sapi_module);
+ }
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+
+DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+ zend_file_handle file_handle;
+ SLS_FETCH();
+ CLS_FETCH();
+ ELS_FETCH();
+ PLS_FETCH();
+
+ init_request_info(sapi_globals, lpECB);
+ SG(server_context) = lpECB;
+ SG(request_info).query_string = lpECB->lpszQueryString;
+
+ file_handle.filename = sapi_globals->request_info.path_translated;
+ file_handle.type = ZEND_HANDLE_FILENAME;
+
+ php_request_startup(CLS_C ELS_CC PLS_CC);
+ php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
+ php_request_shutdown(NULL);
+
+ return HSE_STATUS_SUCCESS;
}
Index: php4/php4isapi/php4isapi.def
diff -u php4/php4isapi/php4isapi.def:1.1 php4/php4isapi/php4isapi.def:1.2
--- php4/php4isapi/php4isapi.def:1.1 Sun Apr 25 15:35:44 1999
+++ php4/php4isapi/php4isapi.def Sun May 2 14:07:42 1999
@@ -1,3 +1,6 @@
EXPORTS
HttpFilterProc
-GetFilterVersion
\ No newline at end of file
+GetFilterVersion
+HttpExtensionProc
+GetExtensionVersion
+TerminateExtension
--
PHP 4 Beta