You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Youichirou Koga <y-...@apache.or.jp> on 2000/12/30 16:39:18 UTC

apache-api/7022: ap_get_server_port doesn't return the real listening port number

>Number:         7022
>Category:       apache-api
>Synopsis:       ap_get_server_port doesn't return the real listening port number
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Sat Dec 30 07:40:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     y-koga@apache.or.jp
>Release:        1.3.15-dev and before
>Organization:
apache
>Environment:
FreeBSD 4.2-STATUS, etc.
>Description:
ap_get_server_port doesn't return the real listening port number.
>How-To-Repeat:
Listen 8080
>Fix:
I made a patch that fixes this problem, but I'm afraid this cause some side effects.

Index: http_core.c
===================================================================
RCS file: /home/y-koga/work/cvs/apache-1.3-cvs/src/main/http_core.c,v
retrieving revision 1.292
diff -u -r1.292 http_core.c
--- http_core.c	2000/11/16 22:28:39	1.292
+++ http_core.c	2000/12/30 07:27:25
@@ -740,6 +740,7 @@
 
 API_EXPORT(unsigned) ap_get_server_port(const request_rec *r)
 {
+#if 0
     unsigned port;
     core_dir_config *d =
       (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
@@ -753,6 +754,8 @@
     }
     /* default */
     return port;
+#endif
+    return ntohs(r->connection->local_addr.sin_port);
 }
 
 API_EXPORT(char *) ap_construct_url(pool *p, const char *uri,

>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]