Re: svn commit: r1592529 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_scgi.c modules/proxy/proxy_util.c

2014-05-05 Thread Marion Christophe JAILLET

Hi,

why not having SCGI_DEFAULT_PORT in a .h file, just as AJP13_DEF_PORT?
This would avoid using SCGI_DEFAULT_PORT in one place and 4000 in another.

Moreover, this could be renamed as SCGI_DEF_PORT to be consistent with AJP.

Just my 2 cents.

CJ

Le 05/05/2014 16:02, traw...@apache.org a écrit :

Author: trawick
Date: Mon May  5 14:02:48 2014
New Revision: 1592529

URL: http://svn.apache.org/r1592529
Log:
mod_proxy_scgi: Support Unix sockets.

ap_proxy_port_of_scheme(): Support default SCGI port (4000).

Modified:
 httpd/httpd/trunk/CHANGES
 httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
 httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/CHANGES
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1592529r1=1592528r2=1592529view=diff
==
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon May  5 14:02:48 2014
@@ -1,6 +1,9 @@
   -*- coding: utf-8 -*-
  Changes with Apache 2.5.0
  
+  *) mod_proxy_scgi: Support Unix sockets.  ap_proxy_port_of_scheme():

+ Support default SCGI port (4000).  [Jeff Trawick]
+
*) mod_proxy_fcgi: Fix occasional high CPU when handling request bodies.
   [Jeff Trawick]
  


Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c?rev=1592529r1=1592528r2=1592529view=diff
==
--- httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c Mon May  5 14:02:48 2014
@@ -176,13 +176,15 @@ static int scgi_canon(request_rec *r, ch
  {
  char *host, sport[sizeof(:65535)];
  const char *err, *path;
-apr_port_t port = SCGI_DEFAULT_PORT;
+apr_port_t port, def_port;
  
  if (strncasecmp(url, SCHEME ://, sizeof(SCHEME) + 2)) {

  return DECLINED;
  }
  url += sizeof(SCHEME); /* Keep slashes */
  
+port = def_port = SCGI_DEFAULT_PORT;

+
  err = ap_proxy_canon_netloc(r-pool, url, NULL, NULL, host, port);
  if (err) {
  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00857)
@@ -190,7 +192,12 @@ static int scgi_canon(request_rec *r, ch
  return HTTP_BAD_REQUEST;
  }
  
-apr_snprintf(sport, sizeof(sport), :%u, port);

+if (port != def_port) {
+apr_snprintf(sport, sizeof(sport), :%u, port);
+}
+else {
+sport[0] = '\0';
+}
  
  if (ap_strchr(host, ':')) { /* if literal IPv6 address */

  host = apr_pstrcat(r-pool, [, host, ], NULL);

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1592529r1=1592528r2=1592529view=diff
==
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon May  5 14:02:48 2014
@@ -3514,6 +3514,7 @@ static proxy_schemes_t pschemes[] =
  {
  {fcgi, 8000},
  {ajp,  AJP13_DEF_PORT},
+{scgi, 4000},
  { NULL, 0x } /* unknown port */
  };
  


Re: svn commit: r1592529 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_scgi.c modules/proxy/proxy_util.c

2014-05-05 Thread Jeff Trawick
On Mon, May 5, 2014 at 2:59 PM, Marion  Christophe JAILLET 
christophe.jail...@wanadoo.fr wrote:

 Hi,

 why not having SCGI_DEFAULT_PORT in a .h file, just as AJP13_DEF_PORT?
 This would avoid using SCGI_DEFAULT_PORT in one place and 4000 in another.

 Moreover, this could be renamed as SCGI_DEF_PORT to be consistent with AJP.

 Just my 2 cents.

 CJ


I previously considered it as a very marginal improvement at best, but
since you asked I'll make the change :)

r1592615

Thanks!


 Le 05/05/2014 16:02, traw...@apache.org a écrit :

  Author: trawick
 Date: Mon May  5 14:02:48 2014
 New Revision: 1592529

 URL: http://svn.apache.org/r1592529
 Log:
 mod_proxy_scgi: Support Unix sockets.

 ap_proxy_port_of_scheme(): Support default SCGI port (4000).

 Modified:
  httpd/httpd/trunk/CHANGES
  httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
  httpd/httpd/trunk/modules/proxy/proxy_util.c

 Modified: httpd/httpd/trunk/CHANGES
 URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=
 1592529r1=1592528r2=1592529view=diff
 
 ==
 --- httpd/httpd/trunk/CHANGES [utf-8] (original)
 +++ httpd/httpd/trunk/CHANGES [utf-8] Mon May  5 14:02:48 2014
 @@ -1,6 +1,9 @@
-*- coding:
 utf-8 -*-
   Changes with Apache 2.5.0
   +  *) mod_proxy_scgi: Support Unix sockets.  ap_proxy_port_of_scheme():
 + Support default SCGI port (4000).  [Jeff Trawick]
 +
 *) mod_proxy_fcgi: Fix occasional high CPU when handling request
 bodies.
[Jeff Trawick]

 Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
 URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/
 proxy/mod_proxy_scgi.c?rev=1592529r1=1592528r2=1592529view=diff
 
 ==
 --- httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c (original)
 +++ httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c Mon May  5 14:02:48
 2014
 @@ -176,13 +176,15 @@ static int scgi_canon(request_rec *r, ch
   {
   char *host, sport[sizeof(:65535)];
   const char *err, *path;
 -apr_port_t port = SCGI_DEFAULT_PORT;
 +apr_port_t port, def_port;
 if (strncasecmp(url, SCHEME ://, sizeof(SCHEME) + 2)) {
   return DECLINED;
   }
   url += sizeof(SCHEME); /* Keep slashes */
   +port = def_port = SCGI_DEFAULT_PORT;
 +
   err = ap_proxy_canon_netloc(r-pool, url, NULL, NULL, host,
 port);
   if (err) {
   ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00857)
 @@ -190,7 +192,12 @@ static int scgi_canon(request_rec *r, ch
   return HTTP_BAD_REQUEST;
   }
   -apr_snprintf(sport, sizeof(sport), :%u, port);
 +if (port != def_port) {
 +apr_snprintf(sport, sizeof(sport), :%u, port);
 +}
 +else {
 +sport[0] = '\0';
 +}
 if (ap_strchr(host, ':')) { /* if literal IPv6 address */
   host = apr_pstrcat(r-pool, [, host, ], NULL);

 Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
 URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/
 proxy/proxy_util.c?rev=1592529r1=1592528r2=1592529view=diff
 
 ==
 --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
 +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon May  5 14:02:48 2014
 @@ -3514,6 +3514,7 @@ static proxy_schemes_t pschemes[] =
   {
   {fcgi, 8000},
   {ajp,  AJP13_DEF_PORT},
 +{scgi, 4000},
   { NULL, 0x } /* unknown port */
   };





-- 
Born in Roswell... married an alien...
http://emptyhammock.com/
http://edjective.org/


Re: svn commit: r1592529 - in /httpd/httpd/trunk: CHANGES modules/proxy/mod_proxy_scgi.c modules/proxy/proxy_util.c

2014-05-05 Thread Marion Christophe JAILLET

Moreover,

all mod_proxy_something that do not append the port when the default is 
used are built this way:


static int FCT_canon(request_rec *r, char *url)
{
[...]
apr_port_t port, def_port;
[...]

if (port != def_port)
apr_snprintf(sport, sizeof(sport), :%d, port);
else
sport[0] = '\0';
[...]
}

All, except scgi, use a :%d. scgi has :%u.

To be consistent, I think that %u should be used in all places.


CJ


Le 05/05/2014 20:59, Marion  Christophe JAILLET a écrit :

Hi,

why not having SCGI_DEFAULT_PORT in a .h file, just as AJP13_DEF_PORT?
This would avoid using SCGI_DEFAULT_PORT in one place and 4000 in 
another.


Moreover, this could be renamed as SCGI_DEF_PORT to be consistent with 
AJP.


Just my 2 cents.

CJ

Le 05/05/2014 16:02, traw...@apache.org a écrit :

Author: trawick
Date: Mon May  5 14:02:48 2014
New Revision: 1592529

URL: http://svn.apache.org/r1592529
Log:
mod_proxy_scgi: Support Unix sockets.

ap_proxy_port_of_scheme(): Support default SCGI port (4000).

Modified:
 httpd/httpd/trunk/CHANGES
 httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
 httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/CHANGES
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1592529r1=1592528r2=1592529view=diff
== 


--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon May  5 14:02:48 2014
@@ -1,6 +1,9 @@
   -*- 
coding: utf-8 -*-

  Changes with Apache 2.5.0
  +  *) mod_proxy_scgi: Support Unix sockets. ap_proxy_port_of_scheme():
+ Support default SCGI port (4000).  [Jeff Trawick]
+
*) mod_proxy_fcgi: Fix occasional high CPU when handling request 
bodies.

   [Jeff Trawick]

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c?rev=1592529r1=1592528r2=1592529view=diff
== 


--- httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_scgi.c Mon May  5 
14:02:48 2014

@@ -176,13 +176,15 @@ static int scgi_canon(request_rec *r, ch
  {
  char *host, sport[sizeof(:65535)];
  const char *err, *path;
-apr_port_t port = SCGI_DEFAULT_PORT;
+apr_port_t port, def_port;
if (strncasecmp(url, SCHEME ://, sizeof(SCHEME) + 2)) {
  return DECLINED;
  }
  url += sizeof(SCHEME); /* Keep slashes */
  +port = def_port = SCGI_DEFAULT_PORT;
+
  err = ap_proxy_canon_netloc(r-pool, url, NULL, NULL, host, 
port);

  if (err) {
  ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00857)
@@ -190,7 +192,12 @@ static int scgi_canon(request_rec *r, ch
  return HTTP_BAD_REQUEST;
  }
  -apr_snprintf(sport, sizeof(sport), :%u, port);
+if (port != def_port) {
+apr_snprintf(sport, sizeof(sport), :%u, port);
+}
+else {
+sport[0] = '\0';
+}
if (ap_strchr(host, ':')) { /* if literal IPv6 address */
  host = apr_pstrcat(r-pool, [, host, ], NULL);

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1592529r1=1592528r2=1592529view=diff
== 


--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Mon May  5 14:02:48 
2014

@@ -3514,6 +3514,7 @@ static proxy_schemes_t pschemes[] =
  {
  {fcgi, 8000},
  {ajp,  AJP13_DEF_PORT},
+{scgi, 4000},
  { NULL, 0x } /* unknown port */
  };