ASF Bugzilla – Attachment 31833 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]
I've added a patch for 2.5-HEAD.
mod_win32.c.patch (text/plain), 2.12 KB, created by
Keith Mashinter
on 2014-07-19 20:10:23 UTC
(
hide
)
Description:
I've added a patch for 2.5-HEAD.
Filename:
MIME Type:
Creator:
Keith Mashinter
Created:
2014-07-19 20:10:23 UTC
Size:
2.12 KB
patch
obsolete
>Index: mod_win32.c >=================================================================== >--- mod_win32.c (revision 1611950) >+++ 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, APLOGNO(02102) > "%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