yunhostnet / pywebsocket

Automatically exported from code.google.com/p/pywebsocket
0 stars 0 forks source link

Unable to identify remote ip #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. print request.connection.remote_ip
2. print request.get_remote_host()

What is the expected output? What do you see instead?
Either 1 or 2 should return me remote ip address.

What version of the product are you using? On what operating system?
On Ubuntu 9.10 -
    1. mod_pywebsocket: web_socket_transfer_data raised exception for 
/register: '_StandaloneConnection' object has no attribute 'remote_ip'

    2. mod_pywebsocket: web_socket_transfer_data raised exception for 
/register: '_StandaloneRequest' object has no attribute 'get_remote_host'

Please provide any additional information below.

pydoc for mod_pywebsocket informs me that -
'''
A Web Socket handler is composed of the following two functions:

        web_socket_do_extra_handshake(request)
        web_socket_transfer_data(request)

    where:
        request: mod_python request.
'''

That request is a mod_python request object, but I am not able to access 1. 
and 2.
I am running in standalone mode. If these properties and methods are not 
available in standalone mode, then what is the other way to access remote 
ip in standalone mode ?

Original issue reported on code.google.com by ideam...@gmail.com on 27 Dec 2009 at 5:59

GoogleCodeExporter commented 9 years ago
Just found a workaround for my needs - request.connection.get_remote_addr()

But if request is a mod_python request object then get_remote_host() must be 
available 
as seen - 
http://www.modpython.org/live/current/doc-html/pyapi-mprequest-meth.html

Original comment by ideam...@gmail.com on 27 Dec 2009 at 6:09

GoogleCodeExporter commented 9 years ago
Hi,

Thank you for the bug report.

You can also use remote_ip property of the connection object (mp_conn)
for both Apache and standalone.py.

I agree that ideally the standalone request object should completely mimic
mod_python request. Unfortunately, there are too many methods and members
to justify the cost of implementation for an experimental/test server.

Original comment by yuzo@chromium.org on 5 Jan 2010 at 9:27

GoogleCodeExporter commented 9 years ago
Thanks!
After some time I did suspect it to be an issue with standalone mode.

Original comment by ideam...@gmail.com on 5 Jan 2010 at 1:07