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 2013/10/15 17:38:09 UTC

svn commit: r1532394 - in /httpd/httpd/trunk: docs/manual/mod/mod_proxy.xml modules/proxy/proxy_util.c

Author: jim
Date: Tue Oct 15 15:38:09 2013
New Revision: 1532394

URL: http://svn.apache.org/r1532394
Log:
Standardize on:

   unix:/path/to/socket|scheme://ignored

for ProxyPass UDS.

Modified:
    httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml
    httpd/httpd/trunk/modules/proxy/proxy_util.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=1532394&r1=1532393&r2=1532394&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_proxy.xml Tue Oct 15 15:38:09 2013
@@ -823,13 +823,14 @@ expressions</description>
     <directive>ProxyPass</directive>.</note>
 
     <p>Support for using a Unix Domain Socket is available by using a target
-    which appends <code>|sock:/path/lis.sock</code>. For example, to proxy
+    which prepends <code>unix:/path/lis.sock|</code>. For example, to proxy
     HTTP and target the UDS at /home/www/socket you would use
-    <code>http://localhost/|sock:/home/www.socket</code>.</p>
+    <code>unix:/home/www.socket|http://localhost/</code>.</p>
 
     <note><strong>Note: </strong>When using Unix Domain Sockets, the hostname and path
-    associated with the 1st URL (<code>http://localhost/</code> in the above
-    example) is ignored; the path associated with the <code>sock:</code>
+    associated with the 2nd URL (<code>http://localhost/</code> in the above
+    example) is ignored; only the scheme is significant.
+    The path associated with the <code>unix:</code>
     URL is <directive>DefaultRuntimeDir</directive> aware.</note>
 
     <p>Suppose the local server has address <code>http://example.com/</code>;

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1532394&r1=1532393&r2=1532394&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Tue Oct 15 15:38:09 2013
@@ -1508,7 +1508,7 @@ PROXY_DECLARE(char *) ap_proxy_worker_na
     if (rv != APR_SUCCESS) {
         return apr_pstrcat(pool, worker->s->name, "|", NULL);
     }
-    return apr_pstrcat(pool, uri.scheme, "://localhost/|sock:", uri.path, NULL);
+    return apr_pstrcat(pool, "unix:", uri.path, "|", uri.scheme, ":", NULL);
 }
 
 PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
@@ -1610,15 +1610,16 @@ PROXY_DECLARE(char *) ap_proxy_define_wo
     char *ptr, *sockpath = NULL;
 
     /* Look to see if we are using UDS:
-       require format: http://ignored/ignored|sock:/path/foo/bar.sock
+       require format: unix:/path/foo/bar.sock|http:
        This results in talking http to the socket at /path/foo/bar.sock
     */
     ptr = ap_strchr((char *)url, '|');
     if (ptr) {
         *ptr = '\0';
-        rv = apr_uri_parse(p, ptr+1, &urisock);
-        if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "sock")) {
+        rv = apr_uri_parse(p, url, &urisock);
+        if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "unix")) {
             sockpath = urisock.path;
+            url = ptr+1;    /* so we get the scheme for the uds */
         }
         else {
             *ptr = '|';
@@ -1627,14 +1628,14 @@ PROXY_DECLARE(char *) ap_proxy_define_wo
     rv = apr_uri_parse(p, url, &uri);
 
     if (rv != APR_SUCCESS) {
-        return "Unable to parse URL";
+        return apr_pstrcat(p, "Unable to parse URL: ", url, NULL);
     }
     if (!uri.scheme) {
-        return "URL must be absolute!";
+        return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);
     }
     /* allow for http:|sock:/path */
     if (!uri.hostname && !sockpath) {
-        return "URL must be absolute!";
+        return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);;
     }
 
     if (sockpath) {