Fossil SCM

IIS and possibly other web servers define environment variables with an empty value. Handle them the same as non-existing environment variables.

tsbg 2019-08-31 13:21 iis-cgi
Commit 9a2ec393db85641bc034289a8ccdddab9a1cd76f3320e0dd9e8aa3f6d6bd3b09
1 file changed +3 -2
+3 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1113,15 +1113,16 @@
11131113
}
11141114
}
11151115
11161116
/* If no match is found and the name begins with an upper-case
11171117
** letter, then check to see if there is an environment variable
1118
- ** with the given name.
1118
+ ** with the given name. Handle environment variables with empty values
1119
+ ** the same as non-existent environment variables.
11191120
*/
11201121
if( zName && fossil_isupper(zName[0]) ){
11211122
const char *zValue = fossil_getenv(zName);
1122
- if( zValue ){
1123
+ if( zValue && zValue[0] ){
11231124
cgi_set_parameter_nocopy(zName, zValue, 0);
11241125
CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
11251126
return zValue;
11261127
}
11271128
}
11281129
--- src/cgi.c
+++ src/cgi.c
@@ -1113,15 +1113,16 @@
1113 }
1114 }
1115
1116 /* If no match is found and the name begins with an upper-case
1117 ** letter, then check to see if there is an environment variable
1118 ** with the given name.
 
1119 */
1120 if( zName && fossil_isupper(zName[0]) ){
1121 const char *zValue = fossil_getenv(zName);
1122 if( zValue ){
1123 cgi_set_parameter_nocopy(zName, zValue, 0);
1124 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
1125 return zValue;
1126 }
1127 }
1128
--- src/cgi.c
+++ src/cgi.c
@@ -1113,15 +1113,16 @@
1113 }
1114 }
1115
1116 /* If no match is found and the name begins with an upper-case
1117 ** letter, then check to see if there is an environment variable
1118 ** with the given name. Handle environment variables with empty values
1119 ** the same as non-existent environment variables.
1120 */
1121 if( zName && fossil_isupper(zName[0]) ){
1122 const char *zValue = fossil_getenv(zName);
1123 if( zValue && zValue[0] ){
1124 cgi_set_parameter_nocopy(zName, zValue, 0);
1125 CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue));
1126 return zValue;
1127 }
1128 }
1129

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button