Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Ticket #645: port0.diff

  • _cpserver.py

    old new  
    112112        t = threading.Thread(target=self._start_http_thread, args=(httpserver,)) 
    113113        t.setName("CPHTTPServer " + t.getName()) 
    114114        t.start() 
    115          
     115        # wait for sometime so that the web server can set bind_addr. Only 
     116        # applicable for port 0 but not special-casing for now. 
     117        print "Sleeping for %d seconds, waiting for web server to set bind_addr" % 5 
     118        time.sleep(5) 
     119 
     120        if isinstance(bind_addr, tuple): 
     121            # update the port to cover the case of port 0. 
     122            self.httpservers[httpserver] = httpserver.bind_addr 
     123            print self.httpservers[httpserver] 
     124            host, port = self.httpservers[httpserver] 
     125            if not host: 
     126                host = '0.0.0.0' 
     127            on_what = "%s://%s:%s/" % (scheme, host, port) 
     128 
    116129        self.wait(httpserver) 
    117130        cherrypy.log("Serving %s on %s" % (scheme.upper(), on_what), 'HTTP') 
    118131     
  • wsgiserver/__init__.py

    old new  
    877877            self.socket = SSLConnection(ctx, self.socket) 
    878878            self.populate_ssl_environ() 
    879879        self.socket.bind(self.bind_addr) 
     880        self.bind_addr = self.socket.getsockname() 
     881        print "CherryPyWSGIServer: Setting the bind_addr to", self.bind_addr 
    880882     
    881883    def tick(self): 
    882884        """Accept a new connection and put it on the Queue.""" 

Hosted by WebFaction

Log in as guest/cpguest to create tickets