Uploaded image for project: 'mod_python'
  1. mod_python
  2. MODPYTHON-120

Connection handler test fails on virtual hosting system such as OpenVPS.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.7
    • Fix Version/s: 3.3.1
    • Component/s: core
    • Labels:
      None

      Description

      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.

      >>> import socket
      >>> socket.gethostbyname("localhost")
      '207.126.122.36'

      This fact causes the connection handler test to fail because it sets up the virtual host listener definition as something like:

      Listen 59180
      <VirtualHost 127.0.0.1:59180>
      SetHandler mod_python
      PythonPath [r'/home/grahamd/mod_python-3.2.7/test/htdocs']+sys.path
      PythonConnectionHandler tests::connectionhandler
      </VirtualHost>

      In this case it really needs to be:

      Listen 59180
      <VirtualHost 207.126.122.36:59180>
      SetHandler mod_python
      PythonPath [r'/home/grahamd/mod_python-3.2.7/test/htdocs']+sys.path
      PythonConnectionHandler tests::connectionhandler
      </VirtualHost>

      To accomodate virtual hosting arrangements, the test might be able to be rewritten as:

      def test_connectionhandler_conf(self):

      try:
      ip = socket.gethostbyname("localhost")
      except:
      ip = "127.0.0.1"

      self.conport = findUnusedPort()
      c = str(Listen("%d" % self.conport)) + \
      str(VirtualHost("%s:%d" % (ip,self.conport),
      SetHandler("mod_python"),
      PythonPath("[r'%s']+sys.path" % DOCUMENT_ROOT),
      PythonConnectionHandler("tests::connectionhandler")))
      return c

      This should always work on UNIX boxes, but whether it does on Win32 boxes would need to be confirmed.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            grahamd Graham Dumpleton
            Reporter:
            grahamd Graham Dumpleton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development