rack-ssl-enforcer icon indicating copy to clipboard operation
rack-ssl-enforcer copied to clipboard

Method + Path combination constraints

Open wyattisimo opened this issue 12 years ago • 12 comments

This update allows you to define constraints for discrete method and path combinations.

See the updated README for more details: https://github.com/Matchbook/rack-ssl-enforcer#method--path-combination-constraints

wyattisimo avatar May 07 '13 17:05 wyattisimo

erg. Travis failed, but all tests passed when I ran them locally.

wyattisimo avatar May 07 '13 17:05 wyattisimo

ooohhh, Travis is testing with 1.8.7, which doesn't support a #length method for Symbol

wyattisimo avatar May 07 '13 17:05 wyattisimo

Amended commit e53a1df to be compatible with Ruby 1.8.7

wyattisimo avatar May 07 '13 19:05 wyattisimo

Thank you @wyattisimo!

It looks good to me, what do you think @tobmatth / @thibaudgg ?

rymai avatar May 08 '13 09:05 rymai

Looks good!

thibaudgg avatar May 08 '13 09:05 thibaudgg

amended commit 10594b6 to fix spelling: "seperately" => "separately"

wyattisimo avatar May 08 '13 15:05 wyattisimo

Don't merge this yet. There's a bug when specifying a :methods_with_paths constraint along with other constraints because in the enforce_ssl_for? method, the if/else block creates two distinct paths of logic, but is contained within a loop using all?.

wyattisimo avatar May 08 '13 16:05 wyattisimo

@rymai I think there's a bug when specifying a :methods_with_paths constraint along with other constraints. Would not merge.

;)

tobmatth avatar May 08 '13 18:05 tobmatth

@rymai @tobmatth Amended commit 00ddb0e with the fixes and a "complex" spec to test specifying :only, :only_methods, and :only_methods_with_paths constraints all at the same time.

This ended up requiring more significant changes than I originally expected. I tweaked enforce_ssl? so it's handling a little more logic and sending the complete list of provided constraints to enforce_ssl_for? (instead of only sending one class of constraints at a time). I think this made it easier to define the logic for combining the groups of constraints properly and actually makes it a little more readable.

Let me know what you think.

wyattisimo avatar May 09 '13 18:05 wyattisimo

Looks good to me now. @tobmatth is it ok for you?

rymai avatar May 14 '13 21:05 rymai

+1 for this pull request!

stevenleeg avatar Jul 15 '13 19:07 stevenleeg

@wyattisimo Could you please rebase on master? Thanks!

@tobmatth What do you think of this PR now?

rymai avatar Sep 06 '13 09:09 rymai