summaryrefslogtreecommitdiff
path: root/modules/proxy/mod_proxy_scgi.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/proxy/mod_proxy_scgi.c')
-rw-r--r--modules/proxy/mod_proxy_scgi.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/proxy/mod_proxy_scgi.c b/modules/proxy/mod_proxy_scgi.c
index f77a986e..7fb2b873 100644
--- a/modules/proxy/mod_proxy_scgi.c
+++ b/modules/proxy/mod_proxy_scgi.c
@@ -37,13 +37,13 @@
#include "util_script.h"
#include "mod_proxy.h"
+#include "scgi.h"
#define SCHEME "scgi"
#define PROXY_FUNCTION "SCGI"
#define SCGI_MAGIC "SCGI"
#define SCGI_PROTOCOL_VERSION "1"
-#define SCGI_DEFAULT_PORT (4000)
/* just protect from typos */
#define CONTENT_LENGTH "CONTENT_LENGTH"
@@ -176,13 +176,15 @@ static int scgi_canon(request_rec *r, char *url)
{
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_DEF_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, char *url)
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);