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 2012/02/09 16:07:23 UTC
svn commit: r1242351 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml
modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_fcgi.c server/util_script.c
Author: jim
Date: Thu Feb 9 15:07:22 2012
New Revision: 1242351
URL: http://svn.apache.org/viewvc?rev=1242351&view=rev
Log:
Handle cases, esp when using mod_proxy_fcgi, when we do not
want SCRIPT_FILENAME to include the query string.
Modified:
httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
httpd/httpd/trunk/modules/proxy/mod_proxy.c
httpd/httpd/trunk/modules/proxy/mod_proxy.h
httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
httpd/httpd/trunk/server/util_script.c
Modified: httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml?rev=1242351&r1=1242350&r2=1242351&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Thu Feb 9 15:07:22 2012
@@ -735,7 +735,7 @@ expressions</description>
<name>ProxyPass</name>
<description>Maps remote servers into the local server URL-space</description>
<syntax>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var>
- <var>[key=value</var> ...]] [nocanon] [interpolate]</syntax>
+ <var>[key=value</var> ...]] [nocanon] [interpolate] [noquery]</syntax>
<contextlist><context>server config</context><context>virtual host</context>
<context>directory</context>
</contextlist>
@@ -1152,6 +1152,11 @@ expressions</description>
so you may still have to resort to <module>mod_rewrite</module>
for complex rules.</p>
+ <p>Normally, mod_proxy will include the query string when
+ generating the <var>SCRIPT_FILENAME</var> environment variable.
+ The optional <var>noquery</var> keyword (available in
+ httpd 2.4.1 and later) prevents this.</p>
+
<p>When used inside a <directive type="section" module="core"
>Location</directive> section, the first argument is omitted and the local
directory is obtained from the <directive type="section" module="core"
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1242351&r1=1242350&r2=1242351&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Thu Feb 9 15:07:22 2012
@@ -636,6 +636,9 @@ PROXY_DECLARE(int) ap_proxy_trans_match(
/* mod_proxy_http needs to be told. Different module. */
apr_table_setn(r->notes, "proxy-nocanon", "1");
}
+ if (ent->flags & PROXYPASS_NOQUERY) {
+ apr_table_setn(r->notes, "proxy-noquery", "1");
+ }
return OK;
}
@@ -1394,6 +1397,9 @@ static const char *
else if (!strcasecmp(word,"interpolate")) {
flags |= PROXYPASS_INTERPOLATE;
}
+ else if (!strcasecmp(word,"noquery")) {
+ flags |= PROXYPASS_NOQUERY;
+ }
else {
char *val = strchr(word, '=');
if (!val) {
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.h?rev=1242351&r1=1242350&r2=1242351&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.h (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.h Thu Feb 9 15:07:22 2012
@@ -106,6 +106,7 @@ struct proxy_remote {
#define PROXYPASS_NOCANON 0x01
#define PROXYPASS_INTERPOLATE 0x02
+#define PROXYPASS_NOQUERY 0x04
struct proxy_alias {
const char *real;
const char *fake;
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=1242351&r1=1242350&r2=1242351&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Feb 9 15:07:22 2012
@@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn
while (to_write) {
apr_size_t n = 0;
rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
- if (rv != APR_SUCCESS) {
+ if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
break;
}
if (n > 0) {
Modified: httpd/httpd/trunk/server/util_script.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1242351&r1=1242350&r2=1242351&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_script.c (original)
+++ httpd/httpd/trunk/server/util_script.c Thu Feb 9 15:07:22 2012
@@ -144,6 +144,7 @@ AP_DECLARE(void) ap_add_common_vars(requ
const apr_table_entry_t *hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
int i;
apr_port_t rport;
+ char *q;
/* use a temporary apr_table_t which we'll overlap onto
* r->subprocess_env later
@@ -241,7 +242,14 @@ AP_DECLARE(void) ap_add_common_vars(requ
apr_table_addn(e, "CONTEXT_PREFIX", ap_context_prefix(r));
apr_table_addn(e, "CONTEXT_DOCUMENT_ROOT", ap_context_document_root(r));
apr_table_addn(e, "SERVER_ADMIN", s->server_admin); /* Apache */
- apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */
+ if (apr_table_get(r->notes, "proxy-noquery") && (q = ap_strchr(r->filename, '?'))) {
+ *q = '\0';
+ apr_table_addn(e, "SCRIPT_FILENAME", apr_pstrdup(r->pool, r->filename));
+ *q = '?';
+ }
+ else {
+ apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */
+ }
rport = c->client_addr->port;
apr_table_addn(e, "REMOTE_PORT", apr_itoa(r->pool, rport));
Re: svn commit: r1242351 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_fcgi.c server/util_script.c
Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 9, 2012, at 11:22 AM, Ruediger Pluem wrote:
>
>> 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=1242351&r1=1242350&r2=1242351&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
>> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Feb 9 15:07:22 2012
>> @@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn
>> while (to_write) {
>> apr_size_t n = 0;
>> rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
>> - if (rv != APR_SUCCESS) {
>> + if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
>> break;
>> }
>> if (n > 0) {
>>
>
> How is this related to the log message and the query string issue?
>
Ugg... good catch. This should not have been included in
the commit since it was something I was testing based on an
Email from Jim Riggs.
Re: svn commit: r1242351 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml
modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_fcgi.c
server/util_script.c
Posted by Jeff Trawick <tr...@gmail.com>.
On Thu, Feb 9, 2012 at 11:39 AM, Jim Riggs <ap...@riggs.me> wrote:
> On Feb 9, 2012, at 10:22 AM, Ruediger Pluem wrote:
>
> > jim@apache.org wrote:
> >> Author: jim
> >> Date: Thu Feb 9 15:07:22 2012
> >> New Revision: 1242351
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1242351&view=rev
> >> Log:
> >> Handle cases, esp when using mod_proxy_fcgi, when we do not
> >> want SCRIPT_FILENAME to include the query string.
> >>
> >> Modified:
> >> httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
> >> httpd/httpd/trunk/modules/proxy/mod_proxy.c
> >> httpd/httpd/trunk/modules/proxy/mod_proxy.h
> >> httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
> >> httpd/httpd/trunk/server/util_script.c
> >>
> >
> >> 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=1242351&r1=1242350&r2=1242351&view=diff
> >>
> ==============================================================================
> >> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
> >> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Feb 9
> 15:07:22 2012
> >> @@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn
> >> while (to_write) {
> >> apr_size_t n = 0;
> >> rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
> >> - if (rv != APR_SUCCESS) {
> >> + if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
> >> break;
> >> }
> >> if (n > 0) {
> >>
> >
> > How is this related to the log message and the query string issue?
>
> It appears this commit has to do with the message I sent the other day (
> http://mail-archives.apache.org/mod_mbox/httpd-dev/201202.mbox/%3C8EA4E5E4-F97E-410B-AAD4-257ECB4F972A@riggs.me%3E
> ).
>
> The question is, was that EAGAIN "fix" supposed to be included in this
> commit or not? Is that even the right "fix"? That was my brute-force
> attempt to address the issue I was having, but I don't know if it is
> correct. Do we need to check in the loop for a timeout or something in case
> we keep receiving EAGAIN? Or would the timeout get picked up and bail out
> elsewhere?
>
>
I'm sure that the check for APR_STATUS_IS_EAGAIN() helped the external
behavior (since the caller asked for non-blocking I/O but didn't handle
EAGAIN), but this change alone results in a busy-loop until the TCP layer
is kind enough to take more data.
E.g.:
644073 15:41:37.771942532 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=8
644076 15:41:37.771952171 1 httpd (15752) < writev res=8 data=........
644081 15:41:37.771991878 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=8200
644088 15:41:37.772019664 1 httpd (15752) < writev res=4344 data=.... ...
644089 15:41:37.772021067 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
644090 15:41:37.772022788 1 httpd (15752) < writev res=-11(EAGAIN) data= <a
href=\"#rewriteengine\">RewriteEngine</a></li>.<li><img alt=\"\"
src=\"../images/
644091 15:41:37.772023931 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
644092 15:41:37.772024933 1 httpd (15752) < writev res=-11(EAGAIN) data= <a
href=\"#rewriteengine\">RewriteEngine</a></li>.<li><img alt=\"\"
src=\"../images/
644093 15:41:37.772025721 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
644094 15:41:37.772026683 1 httpd (15752) < writev res=-11(EAGAIN) data= <a
href=\"#rewriteengine\">RewriteEngine</a></li>.<li><img alt=\"\"
src=\"../images/
644095 15:41:37.772027472 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
644096 15:41:37.772028434 1 httpd (15752) < writev res=-11(EAGAIN) data= <a
href=\"#rewriteengine\">RewriteEngine</a></li>.<li><img alt=\"\"
src=\"../images/
644097 15:41:37.772029239 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
644098 15:41:37.772030198 1 httpd (15752) < writev res=-11(EAGAIN) data= <a
href=\"#rewriteengine\">RewriteEngine</a></li>.<li><img alt=\"\"
src=\"../images/
644099 15:41:37.772031007 1 httpd (15752) > writev
fd=11(<4t>192.168.1.210:41223->192.168.1.211:2003) size=3856
and on and on and on and on.
(Yeah, I like to use mod_rewrite.html.en as a big request or response body
for some reason.)
When send_data() was changed in r390571 to support non-blocking writes, the
single caller of send_data() which enabled that didn't handle EAGAIN, so
the non-blocking feature apparently never worked. I'll yank that logic
now. (That's the extra parameter to send_data(), the non-blocking
enablement/disablement, and checking for EAGAIN.)
--
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/
Re: svn commit: r1242351 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_fcgi.c server/util_script.c
Posted by Jim Riggs <ap...@riggs.me>.
On Feb 9, 2012, at 10:22 AM, Ruediger Pluem wrote:
> jim@apache.org wrote:
>> Author: jim
>> Date: Thu Feb 9 15:07:22 2012
>> New Revision: 1242351
>>
>> URL: http://svn.apache.org/viewvc?rev=1242351&view=rev
>> Log:
>> Handle cases, esp when using mod_proxy_fcgi, when we do not
>> want SCRIPT_FILENAME to include the query string.
>>
>> Modified:
>> httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
>> httpd/httpd/trunk/modules/proxy/mod_proxy.c
>> httpd/httpd/trunk/modules/proxy/mod_proxy.h
>> httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
>> httpd/httpd/trunk/server/util_script.c
>>
>
>> 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=1242351&r1=1242350&r2=1242351&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
>> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Feb 9 15:07:22 2012
>> @@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn
>> while (to_write) {
>> apr_size_t n = 0;
>> rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
>> - if (rv != APR_SUCCESS) {
>> + if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
>> break;
>> }
>> if (n > 0) {
>>
>
> How is this related to the log message and the query string issue?
It appears this commit has to do with the message I sent the other day (http://mail-archives.apache.org/mod_mbox/httpd-dev/201202.mbox/%3C8EA4E5E4-F97E-410B-AAD4-257ECB4F972A@riggs.me%3E).
The question is, was that EAGAIN "fix" supposed to be included in this commit or not? Is that even the right "fix"? That was my brute-force attempt to address the issue I was having, but I don't know if it is correct. Do we need to check in the loop for a timeout or something in case we keep receiving EAGAIN? Or would the timeout get picked up and bail out elsewhere?
Re: svn commit: r1242351 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml
modules/proxy/mod_proxy.c modules/proxy/mod_proxy.h modules/proxy/mod_proxy_fcgi.c
server/util_script.c
Posted by Ruediger Pluem <rp...@apache.org>.
jim@apache.org wrote:
> Author: jim
> Date: Thu Feb 9 15:07:22 2012
> New Revision: 1242351
>
> URL: http://svn.apache.org/viewvc?rev=1242351&view=rev
> Log:
> Handle cases, esp when using mod_proxy_fcgi, when we do not
> want SCRIPT_FILENAME to include the query string.
>
> Modified:
> httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
> httpd/httpd/trunk/modules/proxy/mod_proxy.c
> httpd/httpd/trunk/modules/proxy/mod_proxy.h
> httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
> httpd/httpd/trunk/server/util_script.c
>
> 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=1242351&r1=1242350&r2=1242351&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Thu Feb 9 15:07:22 2012
> @@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn
> while (to_write) {
> apr_size_t n = 0;
> rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
> - if (rv != APR_SUCCESS) {
> + if ((rv != APR_SUCCESS) && !APR_STATUS_IS_EAGAIN(rv)) {
> break;
> }
> if (n > 0) {
>
How is this related to the log message and the query string issue?
Regards
RĂ¼diger