httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf S. Engelschall" <...@engelschall.com>
Subject Re: is_default_port
Date Tue, 26 May 1998 10:58:45 GMT

In article <Pine.LNX.3.96dg4.980525172615.2346C-100000@twinlark.arctic.org> you wrote:

> needs the ap_ prefix.

Yes, same IMHO for default_port() and http_method().
How about the attached patch?
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com

Index: include/compat.h
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/include/compat.h,v
retrieving revision 1.7
diff -u -r1.7 compat.h
--- compat.h	1998/05/06 12:23:40	1.7
+++ compat.h	1998/05/26 10:55:14
@@ -101,6 +101,7 @@
 #define daemons_min_free               ap_daemons_min_free
 #define daemons_to_start               ap_daemons_to_start
 #define day_snames                     ap_day_snames
+#define default_port                   ap_default_port
 #define default_port_for_request       ap_default_port_for_request
 #define default_port_for_scheme        ap_default_port_for_scheme
 #define default_type                   ap_default_type
@@ -160,6 +161,7 @@
 #define hard_timeout                   ap_hard_timeout
 #define header_parse                   ap_header_parse
 #define ht_time                        ap_ht_time
+#define http_method                    ap_http_method
 #define ind                            ap_ind
 #define index_of_response              ap_index_of_response
 #define init_alloc                     ap_init_alloc
@@ -169,6 +171,7 @@
 #define internal_redirect              ap_internal_redirect
 #define internal_redirect_handler      ap_internal_redirect_handler
 #define invoke_handler                 ap_invoke_handler
+#define is_default_port                ap_is_default_port
 #define is_directory                   ap_is_directory
 #define is_fnmatch                     ap_is_fnmatch
 #define is_initial_req                 ap_is_initial_req
Index: include/http_config.h
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/include/http_config.h,v
retrieving revision 1.86
diff -u -r1.86 http_config.h
--- http_config.h	1998/05/19 18:00:59	1.86
+++ http_config.h	1998/05/26 10:55:40
@@ -275,7 +275,7 @@
  * handle it back-compatibly, or at least signal an error).
  */
 
-#define MODULE_MAGIC_NUMBER 19980519
+#define MODULE_MAGIC_NUMBER 19980526
 #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, -1, __FILE__, NULL, NULL
 
 /* Generic accessors for other modules to get at their own module-specific
Index: include/httpd.h
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/include/httpd.h,v
retrieving revision 1.214
diff -u -r1.214 httpd.h
--- httpd.h	1998/05/22 00:37:29	1.214
+++ httpd.h	1998/05/26 10:57:02
@@ -128,9 +128,9 @@
 
 #define DEFAULT_HTTP_PORT	80
 #define DEFAULT_HTTPS_PORT	443
-#define is_default_port(port,r)	((port) == default_port(r))
-#define http_method(r)	"http"
-#define	default_port(r)	DEFAULT_HTTP_PORT
+#define ap_is_default_port(port,r)	((port) == ap_default_port(r))
+#define ap_http_method(r)	"http"
+#define ap_default_port(r)	DEFAULT_HTTP_PORT
 
 /* --------- Default user name and group name running standalone ---------- */
 /* --- These may be specified as numbers by placing a # before a number --- */
Index: main/http_core.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/http_core.c,v
retrieving revision 1.201
diff -u -r1.201 http_core.c
--- http_core.c	1998/05/25 23:37:45	1.201
+++ http_core.c	1998/05/26 10:53:52
@@ -607,7 +607,7 @@
     core_dir_config *d =
       (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
     
-    port = r->server->port ? r->server->port : default_port(r);
+    port = r->server->port ? r->server->port : ap_default_port(r);
 
     if (d->use_canonical_name & 1) {
 	return port;
@@ -624,7 +624,7 @@
       (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
 
     if (d->use_canonical_name & 1) {
-	port = r->server->port ? r->server->port : default_port(r);
+	port = r->server->port ? r->server->port : ap_default_port(r);
 	host = r->server->server_hostname;
     }
     else {
@@ -633,14 +633,14 @@
         else if (r->server->port)
             port = r->server->port;
         else
-            port = default_port(r);
+            port = ap_default_port(r);
 
 	host = r->hostname ? r->hostname : r->server->server_hostname;
     }
-    if (is_default_port(port, r)) {
-	return ap_pstrcat(p, http_method(r), "://", host, uri, NULL);
+    if (ap_is_default_port(port, r)) {
+	return ap_pstrcat(p, ap_http_method(r), "://", host, uri, NULL);
     }
-    return ap_psprintf(p, "%s://%s:%u%s", http_method(r), host, port, uri);
+    return ap_psprintf(p, "%s://%s:%u%s", ap_http_method(r), host, port, uri);
 }
 
 /*****************************************************************
Index: main/http_protocol.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/http_protocol.c,v
retrieving revision 1.215
diff -u -r1.215 http_protocol.c
--- http_protocol.c	1998/05/25 22:55:39	1.215
+++ http_protocol.c	1998/05/26 10:53:55
@@ -590,7 +590,7 @@
     if (is_HTTP_SUCCESS(status)) {
 	/* if it has a scheme we may need to do absoluteURI vhost stuff */
 	if (r->parsed_uri.scheme
-	    && !strcasecmp(r->parsed_uri.scheme, http_method(r))) {
+	    && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))) {
 	    r->hostname = r->parsed_uri.hostname;
 	} else if (r->method_number == M_CONNECT) {
 	    r->hostname = r->parsed_uri.hostname;
Index: main/util.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/main/util.c,v
retrieving revision 1.115
diff -u -r1.115 util.c
--- util.c	1998/05/09 14:27:27	1.115
+++ util.c	1998/05/26 10:51:10
@@ -1137,7 +1137,7 @@
 API_EXPORT(char *) ap_construct_server(pool *p, const char *hostname,
 				    unsigned port, const request_rec *r)
 {
-    if (is_default_port(port, r))
+    if (ap_is_default_port(port, r))
 	return ap_pstrdup(p, hostname);
     else {
 	return ap_psprintf(p, "%s:%u", hostname, port);
Index: modules/proxy/mod_proxy.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/proxy/mod_proxy.c,v
retrieving revision 1.51
diff -u -r1.51 mod_proxy.c
--- mod_proxy.c	1998/04/11 12:00:39	1.51
+++ mod_proxy.c	1998/05/26 10:54:01
@@ -146,9 +146,9 @@
     if (conf->req && r->parsed_uri.scheme) {
 	/* but it might be something vhosted */
        if (!(r->parsed_uri.hostname
-	    && !strcasecmp(r->parsed_uri.scheme, http_method(r))
+	    && !strcasecmp(r->parsed_uri.scheme, ap_http_method(r))
 	    && ap_matches_request_vhost(r, r->parsed_uri.hostname,
-               r->parsed_uri.port_str ? r->parsed_uri.port : default_port(r)))) {
+               r->parsed_uri.port_str ? r->parsed_uri.port : ap_default_port(r))))
{
 	    r->proxyreq = 1;
 	    r->uri = r->unparsed_uri;
 	    r->filename = ap_pstrcat(r->pool, "proxy:", r->uri, NULL);
Index: modules/standard/mod_rewrite.c
===================================================================
RCS file: /e/apache/REPOS/apache-1.3/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.106
diff -u -r1.106 mod_rewrite.c
--- mod_rewrite.c	1998/05/21 10:48:35	1.106
+++ mod_rewrite.c	1998/05/26 10:54:12
@@ -1002,7 +1002,7 @@
     /* add the canonical URI of this URL */
     thisserver = ap_get_server_name(r);
     port = ap_get_server_port(r);
-    if (is_default_port(port, r))
+    if (ap_is_default_port(port, r))
         thisport = "";
     else {
         ap_snprintf(buf, sizeof(buf), ":%u", port);
@@ -1011,7 +1011,7 @@
     thisurl = ap_table_get(r->subprocess_env, ENVVAR_SCRIPT_URL);
 
     /* set the variable */
-    var = ap_pstrcat(r->pool, http_method(r), "://", thisserver, thisport,
+    var = ap_pstrcat(r->pool, ap_http_method(r), "://", thisserver, thisport,
                   thisurl, NULL);
     ap_table_setn(r->subprocess_env, ENVVAR_SCRIPT_URI, var);
 
@@ -2220,7 +2220,7 @@
         olduri = ap_pstrdup(r->pool, r->filename); /* save for logging */
 
         /* cut the hostname and port out of the URI */
-        ap_cpystrn(buf, r->filename+strlen(http_method(r))+3, sizeof(buf));
+        ap_cpystrn(buf, r->filename+strlen(ap_http_method(r))+3, sizeof(buf));
         hostp = buf;
         for (cp = hostp; *cp != '\0' && *cp != '/' && *cp != ':'; cp++)
             ;
@@ -2245,7 +2245,7 @@
             ap_cpystrn(host, hostp, sizeof(host));
             *cp = '/';
             /* set port */
-            port = default_port(r);
+            port = ap_default_port(r);
             /* set remaining url */
             url = cp;
         }
@@ -2253,7 +2253,7 @@
             /* set host */
             ap_cpystrn(host, hostp, sizeof(host));
             /* set port */
-            port = default_port(r);
+            port = ap_default_port(r);
             /* set remaining url */
             url = "/";
         }
@@ -2292,7 +2292,7 @@
           
         thisserver = ap_get_server_name(r);
         port = ap_get_server_port(r);
-        if (is_default_port(port,r))
+        if (ap_is_default_port(port,r))
             thisport = "";
         else {
             ap_snprintf(buf, sizeof(buf), ":%u", port);
@@ -2301,11 +2301,11 @@
 
         if (r->filename[0] == '/')
             r->filename = ap_psprintf(r->pool, "%s://%s%s%s",
-                        http_method(r), thisserver,
+                        ap_http_method(r), thisserver,
                         thisport, r->filename);
         else
             r->filename = ap_psprintf(r->pool, "%s://%s%s/%s",
-                        http_method(r), thisserver,
+                        ap_http_method(r), thisserver,
                         thisport, r->filename);
     }
     return;

Mime
View raw message