how to get remote add use twsited.web2
hi, all i'm new to twisted.web2, and use web2 write my first program i have a question: how to get how to get remote add use twsited.web2 please forgive me stupid english and silly question. thx.
sorry, is REMOTE_ADDR ― The IP address of the client. not remote add 2007/11/20, xiao lianyi <xiaolianyi@gmail.com>:
hi, all
i'm new to twisted.web2, and use web2 write my first program i have a question: how to get how to get remote add use twsited.web2
please forgive me stupid english and silly question.
thx.
On Nov 20, 2007 3:56 PM, xiao lianyi <xiaolianyi@gmail.com> wrote:
sorry, is REMOTE_ADDR — The IP address of the client. not remote add
2007/11/20, xiao lianyi < xiaolianyi@gmail.com>:
hi, all
i'm new to twisted.web2, and use web2 write my first program i have a question: how to get how to get remote add use twsited.web2
please forgive me stupid english and silly question.
thx.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
I believe this is what you are looking for: (twisted.web2.http.Request) http://twistedmatrix.com/projects/web2/documentation/howto/resource-apis.xht...
use request.remoteAddr.host can't get client ip address!!! and i try to use request.headers, but it has not client ip address in it too. blow is my twisted log: 2007-11-20 23:47:56+0800 [HTTPChannel,0,127.0.0.1] <Headers: Raw: {'accept-language': ['zh-CN,zh,en-US;q=0.9,en;q=0.9,UTF-8;q= 0.8,UTF;q=0.8,zh-cn;q=0.7,zh-tw;q=0.7,zh-hans;q=0.6,utf-8;q=0.6,utf;q=0.5 ,en-us;q=0.5,de-DE;q=0.4,de;q=0.4,en-uk;q=0.3,en-AU;q=0.3,it-IT;q=0.2,it;q= 0.2,cs-CZ;q=0.1,cs;q=0.1,en;q=0.0'], 'accept-encoding': ['gzip,deflate'], 'accept': ['text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 ,text/plain;q=0.8,image/png,*/*;q=0.5'], 'user-agent': ['Mozilla/5.0 (X11; U; FreeBSD i386; zh-CN; rv:1.8.1.9) Gecko/20071112 Firefox/2.0.0.9'], 'accept-charset': ['x-gbk,utf-8;q=0.7,*;q=0.7'], 'host': ['localhost:8089'], 'x-requested-with': ['XMLHttpRequest'], 'referer': [' http://localhost/index.html?mid=101&pid=1']} Parsed: {'accept-language': <RecalcNeeded>, 'accept-encoding': <RecalcNeeded>, 'accept': <RecalcNeeded>, 'user-agent': <RecalcNeeded>, 'accept-charset': <RecalcNeeded>, 'host': 'localhost:8089', 'x-requested-with': <RecalcNeeded>, 'referer': <RecalcNeeded>}> 2007/11/20, Graeme Glass <graemeglass@gmail.com>:
I believe this is what you are looking for: (twisted.web2.http.Request)
http://twistedmatrix.com/projects/web2/documentation/howto/resource-apis.xht... <http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web>
On Tue, 20 Nov 2007 23:54:22 +0800, xiao lianyi <xiaolianyi@gmail.com> wrote:
use request.remoteAddr.host can't get client ip address!!!
and i try to use request.headers, but it has not client ip address in it too.
It's better to explain how something didn't meet your expectations rather than to just say that it didn't. What about request.remoteAddr is not suitable? Jean-Paul
I'm sorry for my without thking words saying that use request.remoteAddr.host can't get client ip address actually it works well. Because AJAX's GET or POST method have domain limitation, and I deploy my twisted.web2 program under Nginx. so it is not a client direct request my web2 program, it's nginx request my. web2 program is allways get 127.0.0.1. i solve it in this way, edit nginx configure file, add proxy_set_header REMOTE_ADDR $remote_addr;[1] web2 program file use request.headers._raw_headers.get('remote_addr', ['192.168.1.1'])[0] [1]:http://wiki.codemongers.com/NginxHttpCoreModule#var_remote_addr Graeme Glass,Jean-Paul: thanks for your reply^_^ 2007/11/21, Jean-Paul Calderone <exarkun@divmod.com>:
It's better to explain how something didn't meet your expectations rather than to just say that it didn't.
What about request.remoteAddr is not suitable?
Jean-Paul
i get a road solve this question. http://twistedmatrix.com/projects/web2/documentation/howto/resource-apis.xht... remoteAddr - The address of the remote host, a twisted.internet.interfaces.IAddress. use request.remoteAddr.host can get client ip address
participants (3)
-
Graeme Glass
-
Jean-Paul Calderone
-
xiao lianyi