Skip to content

Commit 6c9d63d

Browse files
authored
less state
1 parent 3e7f9f9 commit 6c9d63d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

sapi/fpm/fpm/fpm_main.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,16 +1124,14 @@ static void init_request_info(void)
11241124
// DocumentRoot /home/hans/web/cyrillicрф.ratma.net/public_html
11251125
// env_script_filename contains /home/hans/web/cyrillic%D1%80%D1%84.ratma.net/public_html/index.php.
11261126
// and we must decode it to /home/hans/web/cyrillicрф.ratma.net/public_html/index.php.
1127-
bool firstrun_apache_cyrillic_encoding = apache_was_here && memchr(pt, '%', len);
1128-
if(firstrun_apache_cyrillic_encoding) {
1127+
if(apache_was_here && memchr(pt, '%', len)) {
11291128
len = php_raw_url_decode(pt, len);
1130-
}
1129+
ptr = &pt[len]; // php_raw_url_decode() writes a trailing null byte, &pt[len] is that null byte.
1130+
goto apache_cyrillic_jump;
1131+
}
11311132
while ((ptr = strrchr(pt, '/')) || (ptr = strrchr(pt, '\\'))) {
1132-
if(firstrun_apache_cyrillic_encoding) {
1133-
firstrun_apache_cyrillic_encoding = false;
1134-
} else {
1135-
*ptr = 0;
1136-
}
1133+
*ptr = 0;
1134+
apache_cyrillic_jump:
11371135
if (stat(pt, &st) == 0 && S_ISREG(st.st_mode)) {
11381136
/*
11391137
* okay, we found the base script!

0 commit comments

Comments
 (0)