unbit/uwsgi — pull request #189 by xtfxme (2013-03-24 20:50:52+00:00)
Title: Routing table appear to go nuts when used within a FOR loop

easy to reproduce... while playing with 1.9 routing capabilities i tried to do this in the INI config:

mount = 360.json=threesixty:entry_json

for = HTTP_HOST REQUEST_URI QUERY_STRING REMOTE_ADDR HTTP_REFERER HTTP_USER_AGENT PATH_INFO
route = ^ log:>>> %(_): ${%(_)}
end-for = 1

route = ^/360/json/ uwsgi:,,,360.json
route = ^/[^/]*$ break:403 Forbidden

...and while it did work as expected, i noticed uWSGI outputting this:

*** dumping internal routing table ***
[rule: 0] subject: path_info regexp: ^ action: log:>>> HTTP_HOST: ${HTTP_HOST}
[rule: 1] subject: path_info regexp: ^ action: log:>>> REQUEST_URI: ${REQUEST_URI}
[rule: 2] subject: path_info regexp: ^ action: log:>>> QUERY_STRING: ${QUERY_STRING}
[rule: 3] subject: path_info regexp: ^ action: log:>>> REMOTE_ADDR: ${REMOTE_ADDR}
[rule: 4] subject: path_info regexp: ^ action: log:>>> HTTP_REFERER: ${HTTP_REFERER}
[rule: 5] subject: path_info regexp: ^ action: log:>>> HTTP_USER_AGENT: ${HTTP_USER_AGENT}
[rule: 6] subject: path_info regexp: ^ action: log:>>> PATH_INFO: ${PATH_INFO}
[rule: 7] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 8] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 9] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 10] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 11] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 12] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 13] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 14] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 15] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 16] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 17] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 18] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 19] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
[rule: 20] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
*** end of the internal routing table ***

...once i remove the loop, i get:

*** dumping internal routing table ***
[rule: 0] subject: path_info regexp: ^/360/json/ action: uwsgi:,,,360.json
[rule: 1] subject: path_info regexp: ^/[^/]*$ action: break:403 Forbidden
*** end of the internal routing table ***

...quite a difference :)