[PHP4BETA] CVS update: php4/php4isapi

From: Date: Tue, 11 May 1999 20:38:17 +0000
Subject: [PHP4BETA] CVS update: php4/php4isapi
Groups: php.version4 
Request: Send a blank email to php-version4+get-778@lists.php.net to get a copy of this message
Date: Tuesday May 11, 1999 @ 16:38 Author: zeev Update of /repository/php4/php4isapi In directory php:/tmp/cvs-serv15443/php4isapi Modified Files: php4isapi.c php4isapi.def Log Message: * Finally commit that -q patch * Refine SAPI built in header support * Use DllMain() in ISAPI to clean after threads and initialize tsrm/sapi as soon as possible. Index: php4/php4isapi/php4isapi.c diff -u php4/php4isapi/php4isapi.c:1.14 php4/php4isapi/php4isapi.c:1.15 --- php4/php4isapi/php4isapi.c:1.14 Sun May 9 16:58:27 1999 +++ php4/php4isapi/php4isapi.c Tue May 11 16:38:17 1999 @@ -12,6 +12,8 @@ #define ISAPI_SERVER_VAR_BUF_SIZE 1024 #define ISAPI_POST_DATA_BUF 1024 +int IWasLoaded=0; + static char *isapi_server_variables[] = { "ALL_HTTP", "APPL_MD_PATH", @@ -157,15 +159,35 @@ *combined_headers_ptr++ = '\n'; *combined_headers_ptr = 0; - header_info.cchStatus = snprintf(status_buf, MAX_STATUS_LENGTH, "%d OK", SG(sapi_headers).http_response_code); - header_info.pszStatus = status_buf; + if (SG(sapi_headers).http_status_line) { + header_info.pszHeader = SG(sapi_headers).http_status_line; + } else { + switch (SG(sapi_headers).http_response_code) { + case 200: + header_info.pszStatus = "200 OK"; + break; + case 302: + header_info.pszStatus = "302 Moved Temporarily"; + break; + case 401: + header_info.pszStatus = "401 Authorization Required"; + break; + default: + snprintf(status_buf, MAX_STATUS_LENGTH, "%d Undescribed", SG(sapi_headers).http_response_code); + header_info.pszStatus = status_buf; + break; + } + } + header_info.cchStatus = strlen(header_info.pszStatus); header_info.pszHeader = combined_headers; header_info.cchHeader = total_length; lpECB->ServerSupportFunction(lpECB, HSE_REQ_SEND_RESPONSE_HEADER_EX, &header_info, NULL, NULL); efree(combined_headers); - + if (SG(sapi_headers).http_status_line) { + efree(SG(sapi_headers).http_status_line); + } return SAPI_HEADER_SENT_SUCCESSFULLY; } @@ -249,12 +271,7 @@ { pFilterVersion->dwFilterVersion = HTTP_FILTER_REVISION; strcpy(pFilterVersion->lpszFilterDesc, sapi_module.name); - pFilterVersion->dwFlags= (SF_NOTIFY_ORDER_HIGH | - SF_NOTIFY_SECURE_PORT | - SF_NOTIFY_NONSECURE_PORT | - SF_NOTIFY_URL_MAP); - tsrm_startup(1, 1, 0); - sapi_startup(&sapi_module); + pFilterVersion->dwFlags= (SF_NOTIFY_AUTHENTICATION | SF_NOTIFY_PREPROC_HEADERS); return TRUE; } @@ -264,14 +281,19 @@ SLS_FETCH(); switch (notificationType) { - case SF_NOTIFY_NONSECURE_PORT: - OutputDebugString("Non secure port\n"); - break; - case SF_NOTIFY_SECURE_PORT: - OutputDebugString("Secure port\n"); + case SF_NOTIFY_PREPROC_HEADERS: + SG(request_info).auth_user = NULL; + SG(request_info).auth_password = NULL; break; - case SF_NOTIFY_URL_MAP: - OutputDebugString("URL Map\n"); + case SF_NOTIFY_AUTHENTICATION: + SG(request_info).auth_user = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser; + SG(request_info).auth_password = ((HTTP_FILTER_AUTHENT *) pvNotification)->pszUser; + if (SG(request_info).auth_user) { + SG(request_info).auth_user = estrdup(SG(request_info).auth_user); + } + if (SG(request_info).auth_password) { + SG(request_info).auth_password = estrdup(SG(request_info).auth_password); + } break; } return SF_STATUS_REQ_NEXT_NOTIFICATION; @@ -298,26 +320,10 @@ { 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; @@ -340,3 +346,31 @@ php_request_shutdown(NULL); return HSE_STATUS_SUCCESS; } + + + +__declspec(dllexport) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + tsrm_startup(1, 1, 0); + sapi_startup(&sapi_module); + if (sapi_module.startup) { + sapi_module.startup(&sapi_module); + } + IWasLoaded = 1; + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + ts_free_thread(); + break; + case DLL_PROCESS_DETACH: + if (sapi_module.shutdown) { + sapi_module.shutdown(&sapi_module); + } + tsrm_shutdown(); + break; + } + return TRUE; +} \ No newline at end of file Index: php4/php4isapi/php4isapi.def diff -u php4/php4isapi/php4isapi.def:1.2 php4/php4isapi/php4isapi.def:1.3 --- php4/php4isapi/php4isapi.def:1.2 Sun May 2 14:07:42 1999 +++ php4/php4isapi/php4isapi.def Tue May 11 16:38:17 1999 @@ -3,4 +3,3 @@ GetFilterVersion HttpExtensionProc GetExtensionVersion -TerminateExtension -- PHP 4 Beta

« previous php.version4 (#778) next »