defnull/bottle — Issue #290: Wrong REMOTE_ADDR reported when running with server='fapws3'
Author: yangzhe1990
Created: 2012-02-29 11:03:08+00:00
State: open

I'm using python-bottle 0.10.7-1 on Debian, with fapws3 0.10.dev.

I find this problem on a heavy load web server. Then I start to test it on my local machine.

With the simple show ip application:

@route('/')
def show_ip():
ip = request.environ.get('REMOTE_ADDR')
# or ip = request.get('REMOTE_ADDR')
# or ip = request['REMOTE_ADDR']
return "%s\n" % ip

run(host='0.0.0.0', port=8080, server='fapws3')

by typing commands quickly (Ctrl-y, Enter, Ctrl-y, Enter, ... ), sometimes I can get:

~$ curl 10.20.1.50:8080 & curl localhost:8080
[1] 14631
10.20.1.50
127.0.0.1
[1]+ DONE curl 10.20.1.50:8080
~$ curl 10.20.1.50:8080 & curl localhost:8080
[1] 14633
127.0.0.1
127.0.0.1

and

~$ curl 10.20.1.50:8080 & curl localhost:8080
[1] 14403
10.20.1.50
10.20.1.50

I'm not sure where the problem comes, from bottle, or fapws3 or their interaction.