You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2017/01/26 03:52:34 UTC
svn commit: r1780328 - in /httpd/httpd/trunk/modules: mappers/mod_actions.c
proxy/mod_proxy_fcgi.c
Author: jim
Date: Thu Jan 26 03:52:34 2017
New Revision: 1780328
URL: http://svn.apache.org/viewvc?rev=1780328&view=rev
Log:
Adjust as needed
Modified:
httpd/httpd/trunk/modules/mappers/mod_actions.c
httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
Modified: httpd/httpd/trunk/modules/mappers/mod_actions.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_actions.c?rev=1780328&r1=1780327&r2=1780328&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_actions.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_actions.c Thu Jan 26 03:52:34 2017
@@ -186,7 +186,8 @@ static int action_handler(request_rec *r
ap_field_noparam(r->pool, r->content_type);
if (action && (t = apr_table_get(conf->action_types, action))) {
- if (*t++ == '0' && r->finfo.filetype == APR_NOFILE) {
+ int virtual = (*t++ == '0' ? 0 : 1);
+ if (!virtual && r->finfo.filetype == APR_NOFILE) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00652)
"File does not exist: %s", r->filename);
return HTTP_NOT_FOUND;
@@ -197,6 +198,9 @@ static int action_handler(request_rec *r
* (will be REDIRECT_HANDLER there)
*/
apr_table_setn(r->subprocess_env, "HANDLER", action);
+ if (virtual) {
+ apr_table_setn(r->notes, "virtual_script", "1");
+ }
}
if (script == NULL)
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?rev=1780328&r1=1780327&r2=1780328&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Jan 26 03:52:34 2017
@@ -269,6 +269,7 @@ static apr_status_t send_environment(pro
apr_status_t rv;
apr_size_t avail_len, len, required_len;
int next_elem, starting_elem;
+ int fpm = 0;
fcgi_req_config_t *rconf = ap_get_module_config(r->request_config, &proxy_fcgi_module);
fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config, &proxy_fcgi_module);
@@ -301,6 +302,8 @@ static apr_status_t send_environment(pro
*qs = '\0';
}
}
+ } else {
+ fpm = 1;
}
if (newfname) {
@@ -318,6 +321,23 @@ static apr_status_t send_environment(pro
ap_add_common_vars(r);
ap_add_cgi_vars(r);
+ if (fpm || apr_table_get(r->notes, "virtual_script")) {
+ /*
+ * Adjust SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED for PHP-FPM
+ * TODO: Right now, PATH_INFO and PATH_TRANSLATED look OK...
+ */
+ const char *pend;
+ const char *script_name = apr_table_get(r->subprocess_env, "SCRIPT_NAME");
+ pend = script_name + strlen(script_name);
+ if (r->path_info && *r->path_info) {
+ pend = script_name + ap_find_path_info(script_name, r->path_info) - 1;
+ }
+ while (pend != script_name && *pend != '/') {
+ pend--;
+ }
+ apr_table_setn(r->subprocess_env, "SCRIPT_NAME", pend);
+ }
+
/* XXX are there any FastCGI specific env vars we need to send? */
/* XXX mod_cgi/mod_cgid use ap_create_environment here, which fills in
Re: svn commit: r1780328 - in /httpd/httpd/trunk/modules:
mappers/mod_actions.c proxy/mod_proxy_fcgi.c
Posted by Eric Covener <co...@gmail.com>.
On Wed, Jan 25, 2017 at 11:34 PM, Jim Jagielski <ji...@jagunet.com> wrote:
> This was tested with:
>
> AddType application/x-php7-fpm .php
> Action application/x-php7-fpm /php7-fpm virtual
> <Location /php7-fpm>
> SetHandler proxy:fcgi://localhost:9000
> </Location>
>
> What setup are you looking at? Can you provide your
> config. I'm testing to see if we even need the dconf->backend_type
> anymore... That is, we always strip the proxy:... stuff.
back to other thread
--
Eric Covener
covener@gmail.com
Re: svn commit: r1780328 - in /httpd/httpd/trunk/modules:
mappers/mod_actions.c proxy/mod_proxy_fcgi.c
Posted by Jim Jagielski <ji...@jaguNET.com>.
This was tested with:
AddType application/x-php7-fpm .php
Action application/x-php7-fpm /php7-fpm virtual
<Location /php7-fpm>
SetHandler proxy:fcgi://localhost:9000
</Location>
What setup are you looking at? Can you provide your
config. I'm testing to see if we even need the dconf->backend_type
anymore... That is, we always strip the proxy:... stuff.
> On Jan 25, 2017, at 11:30 PM, Eric Covener <co...@gmail.com> wrote:
>
> What's the config for this? I am struggling to get PATH_INFO set in a
> non SetHandler situation.
>
> On Wed, Jan 25, 2017 at 10:52 PM, <ji...@apache.org> wrote:
>> Author: jim
>> Date: Thu Jan 26 03:52:34 2017
>> New Revision: 1780328
>>
>> URL: http://svn.apache.org/viewvc?rev=1780328&view=rev
>> Log:
>> Adjust as needed
>>
>> Modified:
>> httpd/httpd/trunk/modules/mappers/mod_actions.c
>> httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
>>
>> Modified: httpd/httpd/trunk/modules/mappers/mod_actions.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_actions.c?rev=1780328&r1=1780327&r2=1780328&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/mappers/mod_actions.c (original)
>> +++ httpd/httpd/trunk/modules/mappers/mod_actions.c Thu Jan 26 03:52:34 2017
>> @@ -186,7 +186,8 @@ static int action_handler(request_rec *r
>> ap_field_noparam(r->pool, r->content_type);
>>
>> if (action && (t = apr_table_get(conf->action_types, action))) {
>> - if (*t++ == '0' && r->finfo.filetype == APR_NOFILE) {
>> + int virtual = (*t++ == '0' ? 0 : 1);
>> + if (!virtual && r->finfo.filetype == APR_NOFILE) {
>> ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00652)
>> "File does not exist: %s", r->filename);
>> return HTTP_NOT_FOUND;
>> @@ -197,6 +198,9 @@ static int action_handler(request_rec *r
>> * (will be REDIRECT_HANDLER there)
>> */
>> apr_table_setn(r->subprocess_env, "HANDLER", action);
>> + if (virtual) {
>> + apr_table_setn(r->notes, "virtual_script", "1");
>> + }
>> }
>>
>> if (script == NULL)
>>
>> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?rev=1780328&r1=1780327&r2=1780328&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
>> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Jan 26 03:52:34 2017
>> @@ -269,6 +269,7 @@ static apr_status_t send_environment(pro
>> apr_status_t rv;
>> apr_size_t avail_len, len, required_len;
>> int next_elem, starting_elem;
>> + int fpm = 0;
>> fcgi_req_config_t *rconf = ap_get_module_config(r->request_config, &proxy_fcgi_module);
>> fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config, &proxy_fcgi_module);
>>
>> @@ -301,6 +302,8 @@ static apr_status_t send_environment(pro
>> *qs = '\0';
>> }
>> }
>> + } else {
>> + fpm = 1;
>> }
>>
>> if (newfname) {
>> @@ -318,6 +321,23 @@ static apr_status_t send_environment(pro
>> ap_add_common_vars(r);
>> ap_add_cgi_vars(r);
>>
>> + if (fpm || apr_table_get(r->notes, "virtual_script")) {
>> + /*
>> + * Adjust SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED for PHP-FPM
>> + * TODO: Right now, PATH_INFO and PATH_TRANSLATED look OK...
>> + */
>> + const char *pend;
>> + const char *script_name = apr_table_get(r->subprocess_env, "SCRIPT_NAME");
>> + pend = script_name + strlen(script_name);
>> + if (r->path_info && *r->path_info) {
>> + pend = script_name + ap_find_path_info(script_name, r->path_info) - 1;
>> + }
>> + while (pend != script_name && *pend != '/') {
>> + pend--;
>> + }
>> + apr_table_setn(r->subprocess_env, "SCRIPT_NAME", pend);
>> + }
>> +
>> /* XXX are there any FastCGI specific env vars we need to send? */
>>
>> /* XXX mod_cgi/mod_cgid use ap_create_environment here, which fills in
>>
>>
>
>
>
> --
> Eric Covener
> covener@gmail.com
Re: svn commit: r1780328 - in /httpd/httpd/trunk/modules:
mappers/mod_actions.c proxy/mod_proxy_fcgi.c
Posted by Eric Covener <co...@gmail.com>.
What's the config for this? I am struggling to get PATH_INFO set in a
non SetHandler situation.
On Wed, Jan 25, 2017 at 10:52 PM, <ji...@apache.org> wrote:
> Author: jim
> Date: Thu Jan 26 03:52:34 2017
> New Revision: 1780328
>
> URL: http://svn.apache.org/viewvc?rev=1780328&view=rev
> Log:
> Adjust as needed
>
> Modified:
> httpd/httpd/trunk/modules/mappers/mod_actions.c
> httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
>
> Modified: httpd/httpd/trunk/modules/mappers/mod_actions.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_actions.c?rev=1780328&r1=1780327&r2=1780328&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_actions.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_actions.c Thu Jan 26 03:52:34 2017
> @@ -186,7 +186,8 @@ static int action_handler(request_rec *r
> ap_field_noparam(r->pool, r->content_type);
>
> if (action && (t = apr_table_get(conf->action_types, action))) {
> - if (*t++ == '0' && r->finfo.filetype == APR_NOFILE) {
> + int virtual = (*t++ == '0' ? 0 : 1);
> + if (!virtual && r->finfo.filetype == APR_NOFILE) {
> ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00652)
> "File does not exist: %s", r->filename);
> return HTTP_NOT_FOUND;
> @@ -197,6 +198,9 @@ static int action_handler(request_rec *r
> * (will be REDIRECT_HANDLER there)
> */
> apr_table_setn(r->subprocess_env, "HANDLER", action);
> + if (virtual) {
> + apr_table_setn(r->notes, "virtual_script", "1");
> + }
> }
>
> if (script == NULL)
>
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?rev=1780328&r1=1780327&r2=1780328&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Jan 26 03:52:34 2017
> @@ -269,6 +269,7 @@ static apr_status_t send_environment(pro
> apr_status_t rv;
> apr_size_t avail_len, len, required_len;
> int next_elem, starting_elem;
> + int fpm = 0;
> fcgi_req_config_t *rconf = ap_get_module_config(r->request_config, &proxy_fcgi_module);
> fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config, &proxy_fcgi_module);
>
> @@ -301,6 +302,8 @@ static apr_status_t send_environment(pro
> *qs = '\0';
> }
> }
> + } else {
> + fpm = 1;
> }
>
> if (newfname) {
> @@ -318,6 +321,23 @@ static apr_status_t send_environment(pro
> ap_add_common_vars(r);
> ap_add_cgi_vars(r);
>
> + if (fpm || apr_table_get(r->notes, "virtual_script")) {
> + /*
> + * Adjust SCRIPT_NAME, PATH_INFO and PATH_TRANSLATED for PHP-FPM
> + * TODO: Right now, PATH_INFO and PATH_TRANSLATED look OK...
> + */
> + const char *pend;
> + const char *script_name = apr_table_get(r->subprocess_env, "SCRIPT_NAME");
> + pend = script_name + strlen(script_name);
> + if (r->path_info && *r->path_info) {
> + pend = script_name + ap_find_path_info(script_name, r->path_info) - 1;
> + }
> + while (pend != script_name && *pend != '/') {
> + pend--;
> + }
> + apr_table_setn(r->subprocess_env, "SCRIPT_NAME", pend);
> + }
> +
> /* XXX are there any FastCGI specific env vars we need to send? */
>
> /* XXX mod_cgi/mod_cgid use ap_create_environment here, which fills in
>
>
--
Eric Covener
covener@gmail.com