httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35999] New: - Port lost after call to "internal_internal_redirect" in "modules/http/http_request.c"
Date Wed, 03 Aug 2005 16:47:52 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35999>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35999

           Summary: Port lost after call to "internal_internal_redirect" in
                    "modules/http/http_request.c"
           Product: Apache httpd-2.0
           Version: 2.0.54
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other Modules
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: jonas.ringh@cixit.se


When using "internal_internal_redirect" the server port the request was made
though is lost. As far as I can tell this is only an issue if you are using a
port that differs from the default one.

Here is one way to reproduce the bug using the rewrite engine...

1. Setup a virtual server to use at least two ports.

--- --- ---
Listen 80
Listen 81

NameVirtualHost x.x.x.x:80
NameVirtualHost x.x.x.x:81
<VirtualHost x.x.x.x:80 x.x.x.x:81>
    DocumentRoot /home/user/bugtest_web
</VirtualHost>
--- --- ---

2. In the root directory of the server, create a test script that prints the
"SERVER_PORT" environment variable. Could for instance be a CGI-script, in which
case you also need to enable ExecCGI for the directory containing the test script.

--- --- ---
#!/bin/sh
echo Content-type: text/plain
echo
echo SERVER_PORT = $SERVER_PORT
--- --- ---

3. Within a "<directory>" directive create a rewrite rule that makes a local
redirect to the test script.

--- --- ---
<directory /home/user/bugtest_web>
    RewriteEngine on
    RewriteRule test test.cgi
</directory>
--- --- ---

4. Navigate to the test file via the rewriterule on both ports...

$ lynx -dump x.x.x.x:80/test
$ lynx -dump x.x.x.x:81/test

In both cases the output will be...
SERVER_PORT = 80

The port that comes first in the virtualhost declaration is the one that is
returned. The port that corresponds to the request is obviously what should be
returned.

After sifting though the source I found that mod_rewrite uses
"ap_internal_redirect" to do the actual redirect.

"ap_internal_redirect" calls "internal_internal_redirect" to setup the
"request_rec" for the new URI. While doing that the original port information
associated with the request is not copied to the new URI.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message