ID: 7782 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Assigned Bug Type: Feature/Change Request Operating System: Windows 2000 PHP Version: 4.0.3pl1 Assigned To: jmoore New Comment:
Was the provided patch ever roled into the code? I've got 4.04 and it still isn't working. Previous Comments: ------------------------------------------------------------------------ [2002-04-23 15:13:30] [EMAIL PROTECTED] this was assigned to the wrong username. ------------------------------------------------------------------------ [2001-11-30 06:40:48] [EMAIL PROTECTED] Assigning to James (As discussed) ------------------------------------------------------------------------ [2001-04-24 08:19:35] [EMAIL PROTECTED] Hi, Due to some problems we have had with the isapi version of php under IIS, we have made some changes in the sourcecode of this isapi module to support Apache style PATH_INFO and PATH_TRANSLATED variables. We tested it with IIS 5 on Windows 2000 Server. (See also Bug number 7782). What we have done: - In the function "init_request_info" we have added some code which will translate the "path_translated" server variable to a path which points to the requested script on disk. - In the function "sapi_isapi_register_server_variables2" we have added some translations for the variables $PATH_INFO and $PATH_TRANSLATED PATH_INFO will now be translated from: /script/path/script.php/some/non/existing/path to /some/non/existing/path PATH_TRANSLATED will be translated from: d:\Inetpub\wwwroot\script.php\some\non\existing\path to d:\Inetpub\wwwroot\script.php - We have added a function named "sapi_isapi_get_server_var" which will retrieve the requested server variable and returns a pointer to it. This function has been added to make things more structured (because of the need to check for a "INSUFFICIENT BUFFER" error). We have made a patch file of these changes against the cvs version 1.7 of php4isapi.c. This path file is attached to this e-mail. Please keep in mind that we did not have the opportunity to test this fix with Zeus. We hope you can/will commit this fix to the php cvs repository. With kind regards, Gijsbert te Riet, Muze. [EMAIL PROTECTED] patch: 16a17 > | IIS PATH_TRANSLATED / PATH_INFO fix: Gijsbert te Riet <[EMAIL PROTECTED]> | 83a85 > "PATH_INFO", 88a91 > "REQUEST_URI", 464a468,492 > static char *sapi_isapi_get_server_var(LPEXTENSION_CONTROL_BLOCK lpECB, char *varname, DWORD *buffer_len) { > char *buffer; > > buffer=emalloc(*buffer_len=ISAPI_SERVER_VAR_BUF_SIZE); > if (!lpECB->GetServerVariable(lpECB->ConnID, varname, buffer, buffer_len)) { > if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { > > buffer = (char *) erealloc(buffer, *buffer_len); > if (!lpECB->GetServerVariable(lpECB->ConnID, varname, buffer, buffer_len)) { > > efree(buffer); > buffer=0; > > } > > } else { > > efree(buffer); > buffer=0; > } > } > > return buffer; > } > 468,469c496 < DWORD variable_len; < char static_variable_buf[ISAPI_SERVER_VAR_BUF_SIZE]; --- > DWORD varsize, varbufsize; 470a498 > char *var_buf1, *var_buf2; 473,478c501,508 < variable_len = ISAPI_SERVER_VAR_BUF_SIZE; < if (lpECB->GetServerVariable(lpECB->ConnID, *p, static_variable_buf, &variable_len) < && static_variable_buf[0]) { < php_register_variable(*p, static_variable_buf, track_vars_array ELS_CC PLS_CC); < if (recorded_values) { < recorded_values[p-server_variables] = estrndup(static_variable_buf, variable_len); --- > > if (variable_buf=sapi_isapi_get_server_var(lpECB, *p, &varsize)) { > // translate PATH_INFO to Apache compatible PATH_INFO > if (strcmp(*p, "PATH_INFO") == 0) { > if (var_buf1=sapi_isapi_get_server_var(lpECB, >"SCRIPT_NAME", &varbufsize)) { > memmove(variable_buf, variable_buf + >strlen(var_buf1), strlen(variable_buf) - strlen(var_buf1) + 1); > efree(var_buf1); > } 480,484c510,519 < } else if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { < variable_buf = (char *) emalloc(variable_len); < if (lpECB->GetServerVariable(lpECB->ConnID, *p, variable_buf, &variable_len) < && variable_buf[0]) { < php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC); --- > > // translate PATH_TRANSLATED to Apache compatible >PATH_TRANSLATED > if (strcmp(*p, "PATH_TRANSLATED") == 0) { > if (var_buf1=sapi_isapi_get_server_var(lpECB, >"PATH_INFO", &varbufsize)) { > if (var_buf2=sapi_isapi_get_server_var(lpECB, >"SCRIPT_NAME", &varbufsize)) { > variable_buf[strlen(variable_buf)-(strlen(var_buf1)-strlen(var_buf2))]='\0'; > efree(var_buf2); > } > efree(var_buf1); > } 485a521,522 > > php_register_variable(*p, variable_buf, track_vars_array ELS_CC PLS_CC); 487,489c524 < recorded_values[p-server_variables] = variable_buf; < } else { < efree(variable_buf); --- > recorded_values[p-server_variables] = >estrndup(variable_buf, varsize); 490a526,527 > > efree(variable_buf); 649a687,691 > char scrambled='\0'; > char pathdelim='\\'; > char *pos=NULL; > char *lastpos; > 652a695,720 > > // Check if PathTranslated really points to our script > if (access(SG(request_info).path_translated, 4) != 0) { > // no, it doesn't: let's translate it > lastpos=pos=SG(request_info).path_translated; > while (*pos && ( pos=(char *)strchr(pos, pathdelim) )) { > if (pos==SG(request_info).path_translated) { > lastpos=++pos; > } else { > > scrambled=*pos; > *pos='\0'; > > if (!access((const char >*)SG(request_info).path_translated,4)) { > > *pos=scrambled; > lastpos=pos++; > } > } > > } > > *lastpos='\0'; > } > > ------------------------------------------------------------------------ [2001-01-28 19:01:33] [EMAIL PROTECTED] After some research ive found that iis doesnt infact support this (dont know why its in CGI specs) You might want to take a look at: http://support.microsoft.com/support/kb/articles/Q184/3/20.ASP and http://support.microsoft.com/support/kb/articles/Q252/3/52.ASP Changing to feature/change reqest. James ------------------------------------------------------------------------ [2001-01-28 16:12:56] [EMAIL PROTECTED] Verified under win2k IIS, will look into it further although this might be a general difference between IIS and Apache PHP has no control over. James ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/7782 -- Edit this bug report at http://bugs.php.net/?id=7782&edit=1