diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2014-07-11 08:11:41 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2014-07-11 08:11:41 -0300 |
commit | d294ef02635c263aabddd07d002467fdb1098446 (patch) | |
tree | c6e9c451bed31e853a8b21d2c9ff16754df78c2c /actionpack | |
parent | 00aae7cb38a9d7029b1530bcf21a89ead80130a4 (diff) | |
parent | e67f001e7c1b3d24750e9dd81006d2ad84bbf50e (diff) | |
download | rails-d294ef02635c263aabddd07d002467fdb1098446.tar.gz rails-d294ef02635c263aabddd07d002467fdb1098446.tar.bz2 rails-d294ef02635c263aabddd07d002467fdb1098446.zip |
Merge pull request #16133 from Agis-/cookie_overflow_check
Use `#bytesize` instead of `#size` when checking for cookie overflow
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG.md | 5 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index fd58f00e83..d63e5c4d6e 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,3 +1,8 @@ +* Use `String#bytesize` instead of `String#size` when checking for cookie + overflow. + + *Agis Anastasopoulos* + * `render nothing: true` or rendering a `nil` body no longer add a single space to the response body. diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index e069840b8e..ac9e5effe2 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -468,7 +468,7 @@ module ActionDispatch options = { :value => @verifier.generate(serialize(name, options)) } end - raise CookieOverflow if options[:value].size > MAX_COOKIE_SIZE + raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE @parent_jar[name] = options end @@ -526,7 +526,7 @@ module ActionDispatch options[:value] = @encryptor.encrypt_and_sign(serialize(name, options[:value])) - raise CookieOverflow if options[:value].size > MAX_COOKIE_SIZE + raise CookieOverflow if options[:value].bytesize > MAX_COOKIE_SIZE @parent_jar[name] = options end |