Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing table appear to go nuts when used within a FOR loop #189

Merged

Conversation

anthonyrisinger
Copy link
Contributor

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 :)

@unbit
Copy link
Owner

unbit commented Mar 24, 2013

endfor not end-for

This is why i continue adding aliases for options (even if some people blame me for this ;)

Do you want making a patch for "end-for" ? (it is a one line of copy&paste, but then i can give you the guilt :P)

@prymitive
Copy link
Contributor

Maybe uWSGI should have --warn-on-unknown-opt or something, so that it be put into "strict mode" config checking and raise error if unknown option is specified (but not comment) ?
So that typos will not go unnoticed?

@prymitive
Copy link
Contributor

or [uwsgi-strict] section for that, instead of [uwsgi]

@anthonyrisinger
Copy link
Contributor Author

lol... damn, i suppose uwsgi was simply looping thru the entire rest of the config then, which was only those two remaining route options.

i would definitely like the --end-* options to allow dashes (i make this mistake constantly) namely because, AFAICT, several --if-* options seem to REQUIRE it... that said, i always write --end-if too...

the recent white/black list appear to have dashes... IMO for, if, and end should too; things look cleaner with dashes :)

i like the idea of some stricter parsing (or maybe more consistent style maybe in long-term),,, could get pretty annoying when using placeholders though.

unbit added a commit that referenced this pull request Mar 25, 2013
Routing table appear to go nuts when used within a FOR loop
@unbit unbit merged commit a83fb26 into unbit:master Mar 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants