You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Lars Eilebrecht <La...@unix-ag.org> on 1998/02/07 19:20:22 UTC

[PATCH] fix problem if Port is unset!

Hi,

recent code changes (UseCanonicalName?) broke all configs where
"Port" is unset.
I noticed it, because I'm typically using "Listen 80" in my configs
and leave "Port" undefined, because "Port 80" is the default.
This results in directory-redirects with a port set to "0".

The UseCanonicalName code uses "r->server->port", but this is
set to "0" in http_config.c. Is there are reason for setting
it to zero? My attached patch uses "default_port(s)" instead
which seems to work for me.

This problem should be fixed before 1.3b4 is released...


ciao...
-- 
Lars Eilebrecht                        - "What you see is all you get."
sfx@unix-ag.org                                       (Brian Kernighan)
http://www.si.unix-ag.org/~sfx/


Re: [PATCH] fix problem if Port is unset!

Posted by Dean Gaudet <dg...@arctic.org>.
I think this breaks something else... please hold off, we can just "Known
bug" the UseCanonicalName directive's behaviour w.r.t. Port for 1.3b4. 

Dean

On Sat, 7 Feb 1998, Lars Eilebrecht wrote:

> Hi,
> 
> recent code changes (UseCanonicalName?) broke all configs where
> "Port" is unset.
> I noticed it, because I'm typically using "Listen 80" in my configs
> and leave "Port" undefined, because "Port 80" is the default.
> This results in directory-redirects with a port set to "0".
> 
> The UseCanonicalName code uses "r->server->port", but this is
> set to "0" in http_config.c. Is there are reason for setting
> it to zero? My attached patch uses "default_port(s)" instead
> which seems to work for me.
> 
> This problem should be fixed before 1.3b4 is released...
> 
> 
> ciao...
> -- 
> Lars Eilebrecht                        - "What you see is all you get."
> sfx@unix-ag.org                                       (Brian Kernighan)
> http://www.si.unix-ag.org/~sfx/
> 
> 

Re: [PATCH] fix problem if Port is unset!

Posted by Ben Laurie <be...@algroup.co.uk>.
Dean Gaudet wrote:
> 
> Randy's "generalize default_port manipulations" patch on feb 2nd is the
> cause of this bug.  Randy I can't figure out why your patch does this:
> 
>   Index: http_config.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
>   retrieving revision 1.94
>   retrieving revision 1.95
>   diff -u -r1.94 -r1.95
>   --- http_config.c     1998/01/21 22:11:01     1.94
>   +++ http_config.c     1998/02/02 22:33:31     1.95
>   @@ -1225,7 +1225,7 @@
>    {
>        server_rec *s = (server_rec *) pcalloc(p, sizeof(server_rec));
> 
>   -    s->port = DEFAULT_PORT;
>   +    s->port = 0;
>        s->server_admin = DEFAULT_ADMIN;
>        s->server_hostname = NULL;
>        s->error_fname = DEFAULT_ERRORLOG;
> 
> Nothing appears to actually test if s->port == 0.  They all test against
> DEFAULT_PORT.  I'm thinking that the above hunk is an SSLism that should
> be backed out.  I'm guessing the SSL is_default_port() function
> understands a 0 port.

My guess would be that Apache-SSL has inadvertantly preserved this
misfeature from the old Apaches that did it this way. I'd check, but
right now I'm chasing that Win32 CGI thing (and its just hung so now to
try with the patch...).

If anyone else finds it is so, let me know, and I'll fix it for the next
release (which is coming soon).

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: [PATCH] fix problem if Port is unset!

Posted by Randy Terbush <ra...@covalent.net>.
Sorry for delay on this. I was looking at just this thing last night.
Looks to me that Lars' patch is the best solution here. I'll commit
this if it hasn't made it there yet.


Dean Gaudet <dg...@arctic.org> wrote:
> Randy's "generalize default_port manipulations" patch on feb 2nd is the
> cause of this bug.  Randy I can't figure out why your patch does this:
> 
>   Index: http_config.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
>   retrieving revision 1.94
>   retrieving revision 1.95
>   diff -u -r1.94 -r1.95
>   --- http_config.c     1998/01/21 22:11:01     1.94
>   +++ http_config.c     1998/02/02 22:33:31     1.95
>   @@ -1225,7 +1225,7 @@
>    {
>        server_rec *s = (server_rec *) pcalloc(p, sizeof(server_rec));
> 
>   -    s->port = DEFAULT_PORT;
>   +    s->port = 0;
>        s->server_admin = DEFAULT_ADMIN;
>        s->server_hostname = NULL;
>        s->error_fname = DEFAULT_ERRORLOG;
> 
> 
> 
> Nothing appears to actually test if s->port == 0.  They all test against
> DEFAULT_PORT.  I'm thinking that the above hunk is an SSLism that should
> be backed out.  I'm guessing the SSL is_default_port() function
> understands a 0 port.
> 
> In any event it looks like mod_rewrite may have some latent
> UseCanonicalName/default_port bugs... I'll look later.  Not showstoppers. 
> 
> Dean
> 
> On Sat, 7 Feb 1998, Lars Eilebrecht wrote:
> 
> > Hi,
> > 
> > recent code changes (UseCanonicalName?) broke all configs where
> > "Port" is unset.
> > I noticed it, because I'm typically using "Listen 80" in my configs
> > and leave "Port" undefined, because "Port 80" is the default.
> > This results in directory-redirects with a port set to "0".
> > 
> > The UseCanonicalName code uses "r->server->port", but this is
> > set to "0" in http_config.c. Is there are reason for setting
> > it to zero? My attached patch uses "default_port(s)" instead
> > which seems to work for me.
> > 
> > This problem should be fixed before 1.3b4 is released...
> > 
> > 
> > ciao...
> > -- 
> > Lars Eilebrecht                        - "What you see is all you get."
> > sfx@unix-ag.org                                       (Brian Kernighan)
> > http://www.si.unix-ag.org/~sfx/
> > 
> > 

Re: [PATCH] fix problem if Port is unset!

Posted by Dean Gaudet <dg...@arctic.org>.
Randy's "generalize default_port manipulations" patch on feb 2nd is the
cause of this bug.  Randy I can't figure out why your patch does this:

  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- http_config.c     1998/01/21 22:11:01     1.94
  +++ http_config.c     1998/02/02 22:33:31     1.95
  @@ -1225,7 +1225,7 @@
   {
       server_rec *s = (server_rec *) pcalloc(p, sizeof(server_rec));

  -    s->port = DEFAULT_PORT;
  +    s->port = 0;
       s->server_admin = DEFAULT_ADMIN;
       s->server_hostname = NULL;
       s->error_fname = DEFAULT_ERRORLOG;



Nothing appears to actually test if s->port == 0.  They all test against
DEFAULT_PORT.  I'm thinking that the above hunk is an SSLism that should
be backed out.  I'm guessing the SSL is_default_port() function
understands a 0 port.

In any event it looks like mod_rewrite may have some latent
UseCanonicalName/default_port bugs... I'll look later.  Not showstoppers. 

Dean

On Sat, 7 Feb 1998, Lars Eilebrecht wrote:

> Hi,
> 
> recent code changes (UseCanonicalName?) broke all configs where
> "Port" is unset.
> I noticed it, because I'm typically using "Listen 80" in my configs
> and leave "Port" undefined, because "Port 80" is the default.
> This results in directory-redirects with a port set to "0".
> 
> The UseCanonicalName code uses "r->server->port", but this is
> set to "0" in http_config.c. Is there are reason for setting
> it to zero? My attached patch uses "default_port(s)" instead
> which seems to work for me.
> 
> This problem should be fixed before 1.3b4 is released...
> 
> 
> ciao...
> -- 
> Lars Eilebrecht                        - "What you see is all you get."
> sfx@unix-ag.org                                       (Brian Kernighan)
> http://www.si.unix-ag.org/~sfx/
> 
>