Skip to content

Commit e0a72f3

Browse files
committed
sapi_getenv: switch logic and simplify
1 parent 602be4a commit e0a72f3

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

main/SAPI.c

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,29 +1007,28 @@ SAPI_API zend_stat_t *sapi_get_stat(void)
10071007

10081008
SAPI_API char *sapi_getenv(const char *name, size_t name_len)
10091009
{
1010-
if (!strncasecmp(name, "HTTP_PROXY", name_len)) {
1011-
/* Ugly fix for HTTP_PROXY issue, see bug #72573 */
1012-
return NULL;
1013-
}
1014-
if (sapi_module.getenv) {
1015-
char *value = NULL, *tmp = sapi_module.getenv(name, name_len);
1016-
if (tmp) {
1017-
value = estrdup(tmp);
1010+
var value = NULL;
1011+
1012+
/* gate: see bug #72573 */
1013+
if (strncasecmp(name, "HTTP_PROXY", name_len)) {
1014+
if (sapi_module.getenv) {
1015+
char *tmp = sapi_module.getenv(name, name_len);
1016+
1017+
if (tmp) {
1018+
value = estrdup(tmp);
10181019
#ifdef PHP_WIN32
1019-
if (strlen(sapi_module.name) == sizeof("cgi-fcgi") - 1 && !strcmp(sapi_module.name, "cgi-fcgi")) {
1020-
/* XXX more modules to go, if needed. */
1021-
free(tmp);
1022-
}
1020+
if (strlen(sapi_module.name) == sizeof("cgi-fcgi") - 1 && !strcmp(sapi_module.name, "cgi-fcgi")) {
1021+
/* XXX more modules to go, if needed. */
1022+
free(tmp);
1023+
}
10231024
#endif
1024-
} else {
1025-
return NULL;
1026-
}
1027-
if (value && sapi_module.input_filter) {
1028-
sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL);
1025+
if (value && sapi_module.input_filter) {
1026+
sapi_module.input_filter(PARSE_STRING, name, &value, strlen(value), NULL);
1027+
}
1028+
}
10291029
}
1030-
return value;
10311030
}
1032-
return NULL;
1031+
return value;
10331032
}
10341033

10351034
SAPI_API int sapi_get_fd(int *fd)

0 commit comments

Comments
 (0)