Fossil SCM
IIS and possibly other web servers define environment variables with an empty value. Handle them the same as non-existing environment variables.
Commit
9a2ec393db85641bc034289a8ccdddab9a1cd76f3320e0dd9e8aa3f6d6bd3b09
Parent
6a59d33e3d1f950…
1 file changed
+3
-2
+3
-2
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1113,15 +1113,16 @@ | ||
| 1113 | 1113 | } |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | 1116 | /* If no match is found and the name begins with an upper-case |
| 1117 | 1117 | ** 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. | |
| 1119 | 1120 | */ |
| 1120 | 1121 | if( zName && fossil_isupper(zName[0]) ){ |
| 1121 | 1122 | const char *zValue = fossil_getenv(zName); |
| 1122 | - if( zValue ){ | |
| 1123 | + if( zValue && zValue[0] ){ | |
| 1123 | 1124 | cgi_set_parameter_nocopy(zName, zValue, 0); |
| 1124 | 1125 | CGIDEBUG(("env-match [%s] = [%s]\n", zName, zValue)); |
| 1125 | 1126 | return zValue; |
| 1126 | 1127 | } |
| 1127 | 1128 | } |
| 1128 | 1129 |
| --- 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 |