Commits

Robert Brewer committed 6109023

Fix for #740 (Default server.socket_host to IPv4 address).

Comments (0)

Files changed (10)

cherrypy/__init__.py

     
     __metaclass__ = _AttributeDocstrings
     
-    request = _cprequest.Request(_http.Host("localhost", 80),
-                                 _http.Host("localhost", 1111))
+    request = _cprequest.Request(_http.Host("127.0.0.1", 80),
+                                 _http.Host("127.0.0.1", 1111))
     request__doc = """
     The request object for the current thread. In the main thread,
     and any threads which are not receiving HTTP requests, this is None."""

cherrypy/_cpmodpy.py

 the apache2 instance. Of course if your application
 resides in the global site-package this won't be needed.
 
-Then restart apache2 and access http://localhost:8080
+Then restart apache2 and access http://127.0.0.1:8080
 """
 
 import StringIO

cherrypy/_cprequest.py

     unless we are processing an InternalRedirect."""
     
     # Conversation/connection attributes
-    local = http.Host("localhost", 80)
+    local = http.Host("127.0.0.1", 80)
     local__doc = \
         "An http.Host(ip, port, hostname) object for the server socket."
     
-    remote = http.Host("localhost", 1111)
+    remote = http.Host("127.0.0.1", 1111)
     remote__doc = \
         "An http.Host(ip, port, hostname) object for the client socket."
     

cherrypy/_cpserver.py

     control them all:
     
         s1 = MyWSGIServer(host='0.0.0.0', port=80)
-        s2 = another.HTTPServer(host='localhost', SSL=True)
+        s2 = another.HTTPServer(host='127.0.0.1', SSL=True)
         cherrypy.server.httpservers = {s1: ('0.0.0.0', 80),
-                                       s2: ('localhost', 443)}
+                                       s2: ('127.0.0.1', 443)}
         # Note we do not use quickstart when we define our own httpservers
         cherrypy.server.start()
     
     
     socket_port = 8080
     
-    _socket_host = 'localhost'
+    _socket_host = '127.0.0.1'
     def _get_socket_host(self):
         return self._socket_host
     def _set_socket_host(self, value):

cherrypy/lib/cptools.py

     if not base:
         port = cherrypy.request.local.port
         if port == 80:
-            base = 'localhost'
+            base = '127.0.0.1'
         else:
-            base = 'localhost:%s' % port
+            base = '127.0.0.1:%s' % port
     
     if base.find("://") == -1:
         # add http:// or https:// if needed

cherrypy/restsrv/servers.py

     control them all:
     
         s1 = MyWSGIServer(host='0.0.0.0', port=80)
-        s2 = another.HTTPServer(host='localhost', SSL=True)
+        s2 = another.HTTPServer(host='127.0.0.1', SSL=True)
         server.httpservers = {s1: ('0.0.0.0', 80),
-                              s2: ('localhost', 443)}
+                              s2: ('127.0.0.1', 443)}
         server.start()
     
     The start, wait, restart, and stop methods control all registered

cherrypy/test/test_http.py

         # By not including a Content-Length header, cgi.FieldStorage
         # will hang. Verify that CP times out the socket and responds
         # with 411 Length Required.
-        c = httplib.HTTPConnection("localhost:%s" % self.PORT)
+        c = httplib.HTTPConnection("127.0.0.1:%s" % self.PORT)
         c.request("POST", "/")
         self.assertEqual(c.getresponse().status, 411)
 

cherrypy/test/test_objectmapping.py

         self.script_name = ""
         
         # Test absoluteURI's in the Request-Line
-        self.getPage('http://localhost/')
+        self.getPage('http://127.0.0.1/')
         self.assertBody('world')
         
         # Test that the "isolated" app doesn't leak url's into the root app.

cherrypy/tutorial/tutorial.conf

 [global]
-server.socket_host = "localhost"
+server.socket_host = "127.0.0.1"
 server.socket_port = 8080
 server.thread_pool = 10

cherrypy/wsgiserver/__init__.py

         return ['Hello world!\n']
     
     server = wsgiserver.CherryPyWSGIServer(
-                ('localhost', 8070), my_crazy_app,
-                server_name='localhost')
+                ('0.0.0.0', 8070), my_crazy_app,
+                server_name='www.cherrypy.example')
     
 The CherryPy WSGI server can serve as many WSGI applications 
 as you want in one instance:
     """
     
     protocol = "HTTP/1.1"
-    _bind_addr = "localhost"
+    _bind_addr = "127.0.0.1"
     version = "CherryPy/3.1alpha"
     ready = False
     _interrupt = None
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.