diff options
author | Zeev Suraski <zeev@php.net> | 2000-02-15 23:31:10 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-02-15 23:31:10 +0000 |
commit | e9dcdb8f97fd167049f8634897876b145660a0aa (patch) | |
tree | ad5b8daf1576e642cdfa26d02dc591212ff3d5a6 /sapi/isapi/php4isapi.c | |
parent | 1f19c43d9d9ea0f9ab965cfee2ee7edf78445bac (diff) | |
download | php-git-e9dcdb8f97fd167049f8634897876b145660a0aa.tar.gz |
@- Improved ISAPI module - it should no longer be necessary to set PHP as
@ an ISAPI filter, only as an ISAPI extension, unless you wish to perform
@ authentication using PHP. This didn't yet get enough testing, but it
@ should work (Zeev)
- Fixed auth_user/auth_password memory leak (I didn't have time to test it under
Apache, feedback welcome!)
Diffstat (limited to 'sapi/isapi/php4isapi.c')
-rw-r--r-- | sapi/isapi/php4isapi.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 80b50cf1d7..24e8a96b2a 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -38,7 +38,7 @@ #define ISAPI_SERVER_VAR_BUF_SIZE 1024 #define ISAPI_POST_DATA_BUF 1024 -int IWasLoaded=0; +static int isapi_globals_id=-1; static char *isapi_server_variables[] = { "ALL_HTTP", @@ -392,8 +392,15 @@ static sapi_module_struct sapi_module = { }; +typedef struct _php_isapi_globals { + char *auth_user; + char *auth_password; +} php_isapi_globals; + + BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion) { + isapi_globals_id = ts_allocate_id(sizeof(php_isapi_globals), NULL, NULL); pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION; strcpy(pFilterVersion->lpszFilterDesc, sapi_module.name); pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS); @@ -403,22 +410,22 @@ BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pFilterVersion) DWORD WINAPI HttpFilterProc(PHTTP_FILTER_CONTEXT pfc, DWORD notificationType, LPVOID pvNotification) { - SLS_FETCH(); + php_isapi_globals *isapi_globals = ts_resource(isapi_globals_id); switch (notificationType) { case SF_NOTIFY_PREPROC_HEADERS: - SG(request_info).auth_user = NULL; - SG(request_info).auth_password = NULL; + isapi_globals->auth_user = NULL; + isapi_globals->auth_password = NULL; break; case SF_NOTIFY_AUTHENTICATION: { char *auth_user = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser; char *auth_password = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszPassword; if (auth_user && auth_user[0]) { - SG(request_info).auth_user = estrdup(auth_user); + isapi_globals->auth_user = estrdup(auth_user); } if (auth_password && auth_password[0]) { - SG(request_info).auth_password = estrdup(auth_password); + isapi_globals->auth_password = estrdup(auth_password); } auth_user[0] = 0; auth_password[0] = 0; @@ -447,6 +454,12 @@ static void init_request_info(sapi_globals_struct *sapi_globals, LPEXTENSION_CON *path_end = '\\'; } } + if (isapi_globals_id!=-1) { /* we have valid ISAPI Filter information */ + php_isapi_globals *isapi_globals = ts_resource(isapi_globals_id); + + SG(request_info).auth_user = isapi_globals->auth_user; + SG(request_info).auth_password = isapi_globals->auth_password; + } } @@ -564,7 +577,6 @@ __declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, L if (sapi_module.startup) { sapi_module.startup(&sapi_module); } - IWasLoaded = 1; break; case DLL_THREAD_ATTACH: break; |