From: William A. Rowe Jr Date: Sun, 23 Jun 2002 09:52:55 +0000 (+0000) Subject: The fix wasn't healthy for Win9x. Work around pre-Unicode flavors. X-Git-Tag: 2.0.40~392 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f0df8fdcf29b368b67cfb23b68d277de657aae4;p=apache The fix wasn't healthy for Win9x. Work around pre-Unicode flavors. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95868 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/arch/win32/mod_win32.c b/modules/arch/win32/mod_win32.c index 1a4ab85743..64aa021ca2 100644 --- a/modules/arch/win32/mod_win32.c +++ b/modules/arch/win32/mod_win32.c @@ -74,6 +74,9 @@ #ifdef WIN32 +extern OSVERSIONINFO osver; /* hiding in mpm_winnt.c */ +static int win_nt; + /* * CGI Script stuff for Win32... */ @@ -141,12 +144,15 @@ static const char *set_interpreter_source(cmd_parms *cmd, void *dv, * will read characters 80-ff. For the moment, use the unicode * values 0080-00ff. This isn't trivial, since the code page * varies between msdos and Windows applications. + * For subsystem 2 [GUI] the default is the system Ansi CP. + * For subsystem 3 [CLI] the default is the system OEM CP. */ static void prep_string(const char ** str, apr_pool_t *p) { const char *ch = *str; char *ch2; int widen = 0; + if (!ch) { return; } @@ -345,7 +351,9 @@ static apr_array_header_t *split_argv(apr_pool_t *p, const char *interp, break; } ap_unescape_url(w); - prep_string(&w, p); + if (win_nt) { + prep_string(&w, p); + } arg = (const char**)apr_array_push(args); *arg = ap_escape_shell_cmd(p, w); } @@ -438,7 +446,9 @@ static apr_array_header_t *split_argv(apr_pool_t *p, const char *interp, break; } ap_unescape_url(w); - prep_string(&w, p); + if (win_nt) { + prep_string(&w, p); + } arg = (const char**)apr_array_push(args); *arg = ap_escape_shell_cmd(p, w); } @@ -584,7 +594,7 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, * application (following the OEM or Ansi code page in effect.) */ for (i = 0; i < r->subprocess_env->a.nelts; ++i) { - if (elts[i].key && *elts[i].key + if (win_nt && elts[i].key && *elts[i].key && (strncmp(elts[i].key, "HTTP_", 5) == 0 || strncmp(elts[i].key, "SERVER_", 7) == 0 || strncmp(elts[i].key, "REQUEST_", 8) == 0 @@ -595,9 +605,16 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, return APR_SUCCESS; } +static int win32_pre_config(apr_pool_t *pconf_, apr_pool_t *plog, apr_pool_t *ptemp) +{ + win_nt = (osver.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS); + return OK; +} + static void register_hooks(apr_pool_t *p) { APR_REGISTER_OPTIONAL_FN(ap_cgi_build_command); + ap_hook_pre_config(win32_pre_config, NULL, NULL, APR_HOOK_MIDDLE); } static const command_rec win32_cmds[] = {