Fossil

Check-in [9a2ec393]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:IIS and possibly other web servers define environment variables with an empty value. Handle them the same as non-existing environment variables.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | iis-cgi
Files: files | file ages | folders
SHA3-256: 9a2ec393db85641bc034289a8ccdddab9a1cd76f3320e0dd9e8aa3f6d6bd3b09
User & Date: tsbg 2019-08-31 13:21:29
Context
2019-08-31
13:53
The IIS web server does not define REQUEST_URI, instead is uses PATH_INFO for virtually the same purpose. Define REQUEST_URI the same as PATH_INFO and redefine PATH_INFO with SCRIPT_NAME removed from the beginning. (Closed-Leaf check-in: 54fdd1a5 user: tsbg tags: iis-cgi)
13:21
IIS and possibly other web servers define environment variables with an empty value. Handle them the same as non-existing environment variables. (check-in: 9a2ec393 user: tsbg tags: iis-cgi)
13:04
Ouput an error if the CGI control file is missing on the command line. This prevents IIS to fall in a endless loop. (check-in: 6a59d33e user: tsbg tags: iis-cgi)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/cgi.c.

1111
1112
1113
1114
1115
1116
1117
1118

1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
    }else{
      lo = mid+1;
    }
  }

  /* If no match is found and the name begins with an upper-case
  ** letter, then check to see if there is an environment variable
  ** with the given name.

  */
  if( zName && fossil_isupper(zName[0]) ){
    const char *zValue = fossil_getenv(zName);
    if( zValue ){
      cgi_set_parameter_nocopy(zName, zValue, 0);
      CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
      return zValue;
    }
  }
  CGIDEBUG(("no-match [%s]\n", zName));
  return zDefault;







|
>



|







1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
    }else{
      lo = mid+1;
    }
  }

  /* If no match is found and the name begins with an upper-case
  ** letter, then check to see if there is an environment variable
  ** with the given name. Handle environment variables with empty values
  ** the same as non-existent environment variables.
  */
  if( zName && fossil_isupper(zName[0]) ){
    const char *zValue = fossil_getenv(zName);
    if( zValue && zValue[0] ){
      cgi_set_parameter_nocopy(zName, zValue, 0);
      CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
      return zValue;
    }
  }
  CGIDEBUG(("no-match [%s]\n", zName));
  return zDefault;