ASF Bugzilla – Attachment 27149 Details for
Bug 51359
Added shebang check for //! so that .js scripts work as CGI based on similar .vbs from [Guenter Knauf]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
mod_win32_js_cgi_for_trunk
mod_win32_js_cgi_for_trunk.patch (text/plain), 2.16 KB, created by
Keith Mashinter
on 2011-06-11 15:49:45 UTC
(
hide
)
Description:
mod_win32_js_cgi_for_trunk
Filename:
MIME Type:
Creator:
Keith Mashinter
Created:
2011-06-11 15:49:45 UTC
Size:
2.16 KB
patch
obsolete
>Index: modules/arch/win32/mod_win32.c >=================================================================== >--- modules/arch/win32/mod_win32.c (revision 1127376) >+++ modules/arch/win32/mod_win32.c (working copy) >@@ -433,6 +433,7 @@ > char buffer[1024]; > apr_size_t bytes = sizeof(buffer); > apr_size_t i; >+ apr_size_t pos; > > /* Need to peek into the file figure out what it really is... > * ### aught to go back and build a cache for this one of these days. >@@ -469,19 +470,30 @@ > } > > /* Script or executable, that is the question... >- * we check here also for '! so that .vbs scripts can work as CGI. >+ * We check here also for '! so that .vbs scripts can work as CGI, >+ * and //! to support .js scripts. > */ >- if ((bytes >= 2) && ((buffer[0] == '#') || (buffer[0] == '\'')) >- && (buffer[1] == '!')) { >+ if ((bytes >= 2) && (buffer[1] == '!') >+ && ((buffer[0] == '#') || (buffer[0] == '\''))) { >+ pos = 2; >+ } >+ else if ((bytes >= 3) && (buffer[2] == '!') >+ && (buffer[0] == '/') && (buffer[1] == '/')) { >+ pos = 3; >+ } >+ else { >+ pos = -1; >+ } >+ if (pos != -1) { > /* Assuming file is a script since it starts with a shebang */ >- for (i = 2; i < bytes; i++) { >+ for (i = pos; i < bytes; i++) { > if ((buffer[i] == '\r') || (buffer[i] == '\n')) { > buffer[i] = '\0'; > break; > } > } > if (i < bytes) { >- interpreter = buffer + 2; >+ interpreter = buffer + pos; > while (apr_isspace(*interpreter)) { > ++interpreter; > } >@@ -507,7 +519,7 @@ > if (!interpreter) { > ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, > "%s is not executable; ensure interpreted scripts have " >- "\"#!\" or \"'!\" first line", *cmd); >+ "\"#!\" or \"'!\" or \"//!\" first line", *cmd); > return APR_EBADF; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51359
:
27147
|
27148
| 27149 |
31833