diff options
| author | Robert Brewer <fumanchu@aminus.org> | 2008-11-08 23:30:21 +0000 |
|---|---|---|
| committer | Robert Brewer <fumanchu@aminus.org> | 2008-11-08 23:30:21 +0000 |
| commit | 4cba9acfc2af2ec487d36452060c651c4472a4e9 (patch) | |
| tree | d7450ac7b684b0b94ec06d9ec5d976cd1b4954f6 /cherrypy/test/webtest.py | |
| parent | 7d39e1464b57ff28a8e87312079c38e5c71db2ab (diff) | |
| download | cherrypy-git-cherrypy-3.1.1.tar.gz | |
Merge from trunk for today's fixes [2072] to [2080].cherrypy-3.1.1
--HG--
branch : cherrypy-3.1.x
Diffstat (limited to 'cherrypy/test/webtest.py')
| -rw-r--r-- | cherrypy/test/webtest.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cherrypy/test/webtest.py b/cherrypy/test/webtest.py index cfcdcd56..ab622d5f 100644 --- a/cherrypy/test/webtest.py +++ b/cherrypy/test/webtest.py @@ -192,6 +192,20 @@ class WebCase(TestCase): self.set_persistent(on) persistent = property(_get_persistent, _set_persistent) + def interface(self): + """Return an IP address for a client connection. + + If the server is listening on '0.0.0.0' (INADDR_ANY) + or '::' (IN6ADDR_ANY), this will return the proper localhost.""" + host = self.HOST + if host == '0.0.0.0': + # INADDR_ANY, which should respond on localhost. + return "127.0.0.1" + if host == '::': + # IN6ADDR_ANY, which should respond on localhost. + return "::1" + return host + def getPage(self, url, headers=None, method="GET", body=None, protocol=None): """Open the url with debugging support. Return status, headers, body.""" ServerError.on = False |
