You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by fu...@apache.org on 2011/01/02 05:33:28 UTC

svn commit: r1054347 - /httpd/httpd/trunk/modules/arch/win32/mod_win32.c

Author: fuankg
Date: Sun Jan  2 04:33:28 2011
New Revision: 1054347

URL: http://svn.apache.org/viewvc?rev=1054347&view=rev
Log:
Added shebang check so that .vbs scripts can work as CGI.

Modified:
    httpd/httpd/trunk/modules/arch/win32/mod_win32.c

Modified: httpd/httpd/trunk/modules/arch/win32/mod_win32.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/arch/win32/mod_win32.c?rev=1054347&r1=1054346&r2=1054347&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/arch/win32/mod_win32.c (original)
+++ httpd/httpd/trunk/modules/arch/win32/mod_win32.c Sun Jan  2 04:33:28 2011
@@ -468,8 +468,11 @@ static apr_status_t ap_cgi_build_command
             memmove(buffer, buffer + 3, bytes -= 3);
         }
 
-        /* Script or executable, that is the question... */
-        if ((bytes >= 2) && (buffer[0] == '#') && (buffer[1] == '!')) {
+        /* Script or executable, that is the question...
+         * we check here also for '! so that .vbs scripts can work as CGI.
+         */
+        if ((bytes >= 2) && ((buffer[0] == '#') || (buffer[0] == '\''))
+                         && (buffer[1] == '!')) {
             /* Assuming file is a script since it starts with a shebang */
             for (i = 2; i < bytes; i++) {
                 if ((buffer[i] == '\r') || (buffer[i] == '\n')) {
@@ -504,7 +507,7 @@ static apr_status_t ap_cgi_build_command
     if (!interpreter) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "%s is not executable; ensure interpreted scripts have "
-                      "\"#!\" first line", *cmd);
+                      "\"#!\" or \"'!\" first line", *cmd);
         return APR_EBADF;
     }