]> granicus.if.org Git - apache/commitdiff
Handle cases, esp when using mod_proxy_fcgi, when we do not
authorJim Jagielski <jim@apache.org>
Thu, 9 Feb 2012 15:07:22 +0000 (15:07 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 9 Feb 2012 15:07:22 +0000 (15:07 +0000)
want SCRIPT_FILENAME to include the query string.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1242351 13f79535-47bb-0310-9956-ffa450edef68

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

index 75e65f46a447487c27322f1264644b36850c6c6d..11f2fa0ec0e39d592638d8663fcb3d94ffb67fba 100644 (file)
@@ -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"
index 3764650a9cd1c3ee7caa34d90902267b55caf722..ede29a1c8dccf95c757b11070c64f566c176106f 100644 (file)
@@ -636,6 +636,9 @@ PROXY_DECLARE(int) ap_proxy_trans_match(request_rec *r, struct proxy_alias *ent,
             /* 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) {
index 285de4222c6258f395b365745264d168fff2acc9..5348d02a1f4f9ccc4089d34a6ad2048e25af26db 100644 (file)
@@ -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;
index 3d08f5144e4f26dadfdadb519dba7b4703bc453f..d0df5fa12fb7a50728aa6df045ea18daae2529a9 100644 (file)
@@ -188,7 +188,7 @@ static apr_status_t send_data(proxy_conn_rec *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) {
index 38dfa0efbdafcc31935a4161707b4db784012e8f..3f7d847a7de169387b89a465be8f24d13bcac01a 100644 (file)
@@ -144,6 +144,7 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
     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(request_rec *r)
     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));