Apache Mod-Python - Work started: (MODPYTHON-121) The local/remote host tests

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > April 2006 > Work started: (MODPYTHON-121) The local/remote host tests





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Work started: (MODPYTHON-121) The local/remote host tests
Graham Dumpleton (JIRA)

2006-04-02, 6:57 pm

[ http://issues.apache.org/jira/brows...ON-121?page=all ]

Work on MODPYTHON-121 started by Graham Dumpleton

> The local/remote host tests fail for a virtual hosting system such as OpenVPS.
> ------------------------------------------------------------------------------
>
> Key: MODPYTHON-121
> URL: http://issues.apache.org/jira/browse/MODPYTHON-121
> Project: mod_python
> Type: Bug
> Versions: 3.2.7
> Reporter: Graham Dumpleton
> Assignee: Graham Dumpleton
> Priority: Minor


>
> On a virtual hosting environment such as OpenVPS, "localhost" does not map to the IP address "127.0.0.1" but the actual IP of the host.
> '207.126.122.36'
> This fact causes various aspects of the test_connection_members() test to fail. To avoid the problem the test could factor in the actual IP as returned for "localhost". Thus in htdocs/tests.py, could read as follows. This should be okay on UNIX systems,

but should be confirmed as okay on Win32 systems.
> def test_connection_members(self):
> req = self.req
> log = req.log_error
> conn = req.connection
> log("Examining connection memebers:")
> try:
> import socket
> ip = socket.gethostbyname("localhost")
> except:
> ip = None
> log(" connection.base_server: %s" % `conn.base_server`)
> if type(conn.base_server) is not type(req.server):
> self.fail("conn.base_server should be same type as req.server")
> log(" connection.local_addr: %s" % `conn.local_addr`)
> if not conn.local_addr[0] in ("127.0.0.1", "0.0.0.0", ip):
> self.fail("conn.local_addr[0] should be '127.0.0.1' or '0.0.0.0'")
> log(" connection.remote_addr: %s" % `conn.remote_addr`)
> if not conn.remote_addr[0] in ("127.0.0.1", "0.0.0.0", ip):
> self.fail("conn.remote_addr[0] should be '127.0.0.1' or '0.0.0.0'")
> log(" connection.remote_ip: %s" % `conn.remote_ip`)
> if not conn.remote_ip in ("127.0.0.1", ip):
> self.fail("conn.remote_ip should be '127.0.0.1'")
> log(" connection.remote_host: %s" % `conn.remote_host`)
> if conn.remote_host is not None:
> self.fail("conn.remote_host should be None")
> log(" connection.remote_logname: %s" % `conn.remote_logname`)
> if conn.remote_logname is not None:
> self.fail("conn.remote_logname should be None")
> log(" connection.aborted: %s" % `conn.aborted`)
> if conn.aborted != 0:
> self.fail("conn.aborted should be 0")
> log(" connection.keepalive: %s" % `conn.keepalive`)
> if conn.keepalive != 2:
> self.fail("conn.keepalive should be 2")
> log(" connection.double_reverse: %s" % `conn.double_reverse`)
> if conn.double_reverse != 0:
> self.fail("conn.double_reverse should be 0")
> log(" connection.keepalives: %s" % `conn.keepalives`)
> if conn.keepalives != 1:
> self.fail("conn.keepalives should be 1")
> log(" connection.local_ip: %s" % `conn.local_ip`)
> if not conn.local_ip in ("127.0.0.1", ip):
> self.fail("conn.local_ip should be '127.0.0.1'")
> log(" connection.local_host: %s" % `conn.local_host`)
> if conn.local_host is not None:
> self.fail("conn.local_host should be None")
> log(" connection.id: %s" % `conn.id`)
> if conn.id > 100:
> self.fail("conn.id should not be this high")
> log(" connection.notes: %s" % `conn.notes`)
> if `conn.notes` != '{}':
> self.fail("conn.notes should be {}")


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com