httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wolfgang <wolfgang...@gmail.com>
Subject How to get a port number.
Date Sun, 18 Jan 2009 19:36:14 GMT
Hi there,

I can not get a port number if my apache module is set in the main
server config and listen port is set to 10080.
( "the main server config" means other than virtual host configs. )

When my apache module is set in the main server config as follows and
a client requests "http://www.example.com:10080".

In httpd.conf,
...
Listen 10080
<Location "/">
   SetHandler mymodule
</Location>
....

Then, in mymodule I get the following results.

request_rec->server->is_virtual is 0.
ap_get_server_port(request_rec)" is 80.          <----- 80 !? why not 10080 ??
request_rec->server->port is 0.                      <----- ZERO !? hm...
request_rec->server->addrs->host_port is 0.   <----- ZERO... Sure, my
module is not in a virtual host.

But if I set the module in a virtual host config as follows and a
client requests "http://www.example.com:10080"

In httpd.conf,
...
Listen 10080
NameVirtualHost *:10080
<VirtualHost *:10080>
    ServerName www.example.com
    DocumentRoot "htdocs"
    ...
  <Location "/">
    SetHandler mymodule
  </Location>
</VirtualHost>

Then, in mymodule I get the following results.

request_rec->server->is_virtual is 1.
ap_get_server_port(request_rec)" is 80.
request_rec->server->port is 0.
request_rec->server->addrs->host_port is 10080.  <--- GOTCHA !

How can I get the port number when my apache module is set in the main
server config ??

The version of my apache is 2.2.11 with mod_ssl but EAPI is not enabled.


Regards,

wolfgang

Mime
View raw message