bug in v1.2.15R5 IIS7 only

Feb 9, 2009 at 3:21 PM
on IIS7  the "OPTIONS" verb does not generate a "SF_NOTIFY_URL_MAP" notification.  Without that notification, pfc->pFilterContext is NULL. In GetServerVariable, when the variable name is "REQUEST_FILENAME", a reference of NULL causes the IIRF to FAIL, and the application pool to fail.

This problem occurs when bots are testing to see of a directory is listable and one has used REQUEST_FILENAME in the IIRF ini file.

The short term fix is to test for a value of NULL (line 3084 of R5):

  LogMessage(5,"GetServerVariable: special variable name");
  // sometimes ctx is NULL
  if(ctx != NULL){
   if ((ctx->Magic == IIRF_CONTEXT_MAGIC_NUMBER) && (ctx->PhysicalPath!=NULL))  {
    strcpy_s(pszBuf,DEFAULT_BUFFER_SIZE,ctx->PhysicalPath);
    cbBuf= strlen(ctx->PhysicalPath);
   }
   else {
    strcpy_s(pszBuf,DEFAULT_BUFFER_SIZE,VariableName);
    cbBuf= strlen(pszBuf);
   }
  }
  else {
   strcpy_s(pszBuf,DEFAULT_BUFFER_SIZE,VariableName);
   cbBuf= strlen(pszBuf);
  }
  // end fix

To reproduce this error, use this aspx script:
<%
 Dim myurl As String = "http://127.0.0.1/html/"
 Dim myRequest As System.Net.WebRequest = System.Net.WebRequest.Create(myurl)
 myRequest.Method = "OPTIONS"
 Dim myResponse As system.net.HttpWebResponse = CType(myRequest.GetResponse(), system.net.HttpWebResponse)
 Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
 Dim readStream As New system.io.StreamReader(myResponse.GetResponseStream(), encode)
 Response.Write(readStream.ReadToEnd())
 readStream.close()
 myResponse.close()
%>
and an INI file:
RewriteCond %{HTTP_URL}             (^[^\.]+$)
RewriteCond %{APPL_PHYSICAL_PATH}/default.aspx     -f
RewriteCond %{REQUEST_FILENAME}     !-f
RewriteCond %{REQUEST_FILENAME}     !-d                                 
RewriteRule ^(.*)/(.+)$             $1/default.aspx?menugroup=$2                      [I,L]


NOTE: the directory should exist on the website.  Probably a better fix is the call OnUrlMap() at a different time. But I'll leave this up to Cheeso.

This error does not occur under XP or Windows 2003 Server.  I have not tested Vista.