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

Changeset 583

Show
Ignore:
Timestamp:
08/31/05 13:13:41
Author:
speno
Message:

Added cherrypy.request.remotePort; the TCP port from which the client's
connection originates. Added this attribute to the book also.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cphttpserver.py

    r538 r583  
    8484        cherrypy.request.multithread = cherrypy.config.get("server.threadPool") > 1 
    8585        cherrypy.request.multiprocess = False 
    86         cherrypy.server.request(self.client_address[0]
     86        cherrypy.server.request(self.client_address
    8787                                self.address_string(), 
    8888                                self.raw_requestline, 
  • trunk/cherrypy/_cphttptools.py

    r580 r583  
    163163        """Populate a new Request object. 
    164164         
    165         clientAddress and remoteHost should be IP address strings. 
     165        clientAddress should be a tuple of client IP address, client Port 
     166        remoteHost should be string of the client's IP address. 
    166167        requestLine should be of the form "GET /path HTTP/1.0". 
    167168        headers should be a list of (name, value) tuples. 
     
    187188         
    188189        # Prepare cherrypy.request variables 
    189         cherrypy.request.remoteAddr = clientAddress 
     190        cherrypy.request.remoteAddr = clientAddress[0] 
     191        cherrypy.request.remotePort = clientAddress[1] 
    190192        cherrypy.request.remoteHost = remoteHost 
    191193        cherrypy.request.paramList = [] # Only used for Xml-Rpc 
  • trunk/cherrypy/_cpwsgi.py

    r579 r583  
    9696        cherrypy.request.multithread = environ['wsgi.multithread'] 
    9797        cherrypy.request.multiprocess = environ['wsgi.multiprocess'] 
    98         cherrypy.server.request(environ.get('REMOTE_ADDR', ''), 
     98        clientAddr = ( 
     99            environ.get('REMOTE_ADDR', ''), 
     100            int(environ.get('REMOTE_PORT', -1)) 
     101        ) 
     102        cherrypy.server.request(clientAddr, 
    99103                                environ.get('REMOTE_ADDR', ''), 
    100104                                requestLine(environ), 
  • trunk/cherrypy/server.py

    r581 r583  
    173173    """request(clientAddress, remoteHost, requestLine, headers, rfile, scheme="http") 
    174174     
    175     clientAddress: the IP address of the client 
     175    clientAddress: the (IP address, port) of the client 
    176176    remoteHost: the IP address of the client 
    177177    requestLine: "<HTTP method> <url?qs> HTTP/<version>", 
  • trunk/docs/book/xml/apireference.xml

    r414 r583  
    2222        <section> 
    2323          <title>cherrypy.request.remoteAddr</title> 
    24           <para>This attribute is a string containing the IP address of the client.</para> 
     24          <para>This attribute is a string containing the IP address of the 
     25          client. It will be an empty string if it is not available.</para> 
     26        </section> 
     27      </listitem> 
     28      <listitem> 
     29        <section> 
     30          <title>cherrypy.request.remotePort</title> 
     31          <para>This attribute is an int containing the TCP port number of 
     32          the client. It will be -1 if it is not available.</para> 
    2533        </section> 
    2634      </listitem> 

Hosted by WebFaction

Log in as guest/cpguest to create tickets