Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Mar 5, 2015
  1. @jeremy

    Revert "Merge pull request #813 from eileencodes/remove-check-for-nil"

    jeremy authored
    Add a test demonstrating that `nil` is treated as an empty query string
    
    This reverts commit 7788a1b, reversing
    changes made to e117591.
Commits on Mar 1, 2015
  1. @spastorino

    Merge pull request #809 from tgxworld/reduce_allocations

    spastorino authored
    Reduce allocations
  2. @eileencodes

    Remove check for `nil` on `qs`

    eileencodes authored
    Fixed by brynary/rack-test@4a4b2c1. rack-test was turning the query
    string to nil if there was no argument passed in the params. This extra
    `nil` check is no longer necessary after the changes made to the
    rack-test gem. Fixes issue brought up in #800.
Commits on Feb 25, 2015
  1. @tgxworld

    Prefer String concatenation.

    tgxworld authored
    Before:
    ```
    [["rack/lib/rack/utils.rb", 280, :T_STRING], [12004, 0, 11304, 0, 1, 463840]]
    ```
    
    After:
    ```
    [["rack/lib/rack/utils.rb", 280, :T_STRING], [5996, 0, 5706, 0, 2, 232320]]
    ```
  2. @tgxworld

    Reduce String allocations by storing common seperators in a constant.

    tgxworld authored
    Before:
    ```
    [["rack/lib/rack/utils.rb", 87, :T_STRING], [111173, 57, 106670, 0, 27, 12654156]]
    [["rack/lib/rack/utils.rb", 115, :T_STRING], [30244, 58, 29580, 0, 27, 3275248]]
    ```
    
    After:
    ```
    [["rack/lib/rack/utils.rb", 88, :T_STRING], [20979, 136, 21178, 0, 27, 1677320]]
    [["rack/lib/rack/utils.rb", 116, :T_STRING], [8995, 137, 9943, 0, 27, 581392]]
    ```
  3. @tgxworld

    Reduce Array allocations.

    tgxworld authored
    Before
    ```
    [["rack/lib/rack/utils.rb", 116, :T_ARRAY], [11988, 0, 11663, 0, 2, 463840]]
    ```
    
    After
    ```
    [["rack/lib/rack/utils.rb", 116, :T_ARRAY], [6002, 0, 5624, 0, 2, 232640]]
    ```
  4. @tgxworld

    Reduce String allocations.

    tgxworld authored
    Before:
    ```
    [["rack/lib/rack/utils.rb", 89, :T_STRING], [41986, 0, 40154, 0, 2, 1627920]]
    [["rack/lib/rack/utils.rb", 116, :T_STRING], [17982, 0, 17490, 0, 2, 695760]]
    ```
    
    After:
    ```
    [["rack/lib/rack/utils.rb", 89, :T_STRING], [27000, 0, 25875, 0, 1, 1046880]]
    [["rack/lib/rack/utils.rb", 116, :T_STRING], [12000, 0, 11283, 0, 2, 465120]]
    ```
Commits on Feb 19, 2015
  1. @tenderlove
  2. @tenderlove
  3. @tenderlove

    Merge pull request #801 from tgxworld/reduce_object_allocation

    tenderlove authored
    Reduce object allocation.
  4. @tgxworld

    Reduce string allocations.

    tgxworld authored
    Before total allocations = 69010
    ```
    [[rack/lib/rack/utils.rb", 314, :T_STRING], [39000, 22, 38009, 0, 27, 2536600]]
    [[rack/lib/rack/utils.rb", 312, :T_STRING], [12004, 0, 11518, 0, 2, 464800]]
    [[rack/lib/rack/utils.rb", 313, :T_STRING], [18006, 0, 17274, 0, 1, 2803325]]
    ```
    
    After total allocations = 45000
    ```
    [[rack/lib/rack/utils.rb", 315, :T_STRING], [45000, 41, 45338, 0, 28, 4160731]]
    ```
Commits on Feb 18, 2015
  1. @eileencodes

    Clean up `@names` hash

    eileencodes authored
    Tidies up the `@names` hash so we don't need to store as much in it.
  2. @tgxworld

    Reduce object allocation.

    tgxworld authored
    Before:
    ```
    [[".rbenv/versions/2.2.0/lib/ruby/2.2.0/uri/common.rb", 383, :T_STRING], [113158, 342, 114877, 0, 28, 5989110]]
    [["rack/lib/rack/utils.rb", 87, :T_STRING], [110615, 57, 108492, 0, 28, 12576892]]
    [["rails-dev-box/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb", 243, :T_STRING], [59564, 0, 58024, 0, 1, 2304160]]
    [["rack/lib/rack/utils.rb", 89, :T_ARRAY], [56601, 0, 55128, 0, 2, 2189560]]
    [["rails-dev-box/rails/actionpack/lib/action_controller/metal/strong_parameters.rb", 541, :T_STRING], [54652, 0, 53229, 0, 2, 5830250]]
    [["rails-dev-box/rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [53606, 0, 52222, 0, 1, 2073520]]
    [["rails-dev-box/rails/activesupport/lib/active_support/notifications/instrumenter.rb", 52, :T_HASH], [50621, 16, 49447, 0, 22, 8126520]]
    [["rack/lib/rack/utils.rb", 89, :T_STRING], [41706, 0, 40620, 0, 2, 1613360]]
    [["rails-dev-box/rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [41694, 0, 40618, 0, 1, 4676888]]
    [["rails-dev-box/rails/activerecord/lib/active_record/relation/query_methods.rb", 56, :T_ARRAY], [41690, 0, 40612, 0, 1, 1612560]]
    ```
    After:
    ```
    [[".rbenv/versions/2.2.0/lib/ruby/2.2.0/uri/common.rb", 383, :T_STRING], [113994, 348, 116830, 0, 28, 6032912]]
    [["rack/lib/rack/utils.rb", 87, :T_STRING], [111363, 58, 110247, 0, 28, 12668100]]
    [["rails-dev-box/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb", 243, :T_STRING], [59996, 0, 58968, 0, 1, 2321120]]
    [["rails-dev-box/rails/actionpack/lib/action_controller/metal/strong_parameters.rb", 541, :T_STRING], [54964, 0, 54050, 0, 1, 5870020]]
    [["rails-dev-box/rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [53990, 0, 53070, 0, 1, 2088880]]
    [["rails-dev-box/rails/activesupport/lib/active_support/notifications/instrumenter.rb", 52, :T_HASH], [50989, 11, 50231, 0, 25, 8188064]]
    [["rails-dev-box/rails/activerecord/lib/active_record/relation/query_methods.rb", 56, :T_ARRAY], [42006, 0, 41282, 0, 1, 1624960]]
    [["rack/lib/rack/utils.rb", 89, :T_ARRAY], [42002, 0, 41278, 0, 2, 1624880]]
    [["rack/lib/rack/utils.rb", 89, :T_STRING], [42002, 0, 41279, 0, 2, 1624880]]
    [["rails-dev-box/rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [42000, 0, 41286, 0, 1, 4712384]]
    ```
Commits on Feb 17, 2015
  1. @eileencodes

    Fix bug when `qs` is `nil`

    eileencodes authored
    In c4596b3 I failed to test Rails tests and in working on other issues
    discovered some Rails ActionPack tests weren't erroring. I found that
    sometimes `qs` is nil so I changed this to check for `qs.nil? || qs.empty?`.
Commits on Feb 11, 2015
  1. @eileencodes

    Reduce object allocations in Rack::Utils

    eileencodes authored
    Using AllocationTracer we were able to find unnecessary allocations of
    objects.
    
    1) `[]=` is duping the hash key object on assignment. Frezing
    `k.downcase` will prevent this.
    
    2) `parse_nested_query` was taking unnecessary steps when the string was
    empty. We can just return a `{}` instead if `qs` is empty.
    
    AllocationTracer object allocation before these changes:
    ```
    [["/rack/lib/rack/utils.rb", 500, :T_STRING], [56981, 4303, 78980, 0, 13, 2032240]]
    [["/rack/lib/rack/utils.rb", 498, :T_STRING], [51000, 0, 45775, 0, 2, 1904680]]
    [["/rack/lib/rack/utils.rb", 114, :T_STRING], [39123, 0, 35116, 0, 1, 4711600]]
    [["/rack/lib/rack/utils.rb", 661, :T_STRING], [32993, 0, 29621, 0, 1, 1232289]]
    [["/rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [30000, 0, 26930, 0, 1, 1120400]]
    ```
    AllocationTracer object allocation after these changes:
    ```
    [["/rack/lib/rack/utils.rb", 499, :T_STRING], [46665, 969, 54210, 0, 13, 1702720]]
    [["/rack/lib/rack/utils.rb", 662, :T_STRING], [31375, 0, 30647, 0, 2, 1175369]]
    [["/rack/lib/rack/body_proxy.rb", 34, :T_ARRAY], [28550, 0, 27880, 0, 2, 1068800]]
    [["/rails/activesupport/lib/active_support/subscriber.rb", 99, :T_STRING], [28534, 0, 27869, 0, 2, 1068560]]
    [["/rails/activesupport/lib/active_support/notifications/fanout.rb", 55, :T_DATA], [28528, 0, 27864, 0, 2, 3098592]]
    ```
Commits on Dec 23, 2014
  1. @spastorino
  2. @spastorino
Commits on Nov 27, 2014
  1. @byroot
Commits on Nov 26, 2014
  1. @spastorino
  2. @byroot @spastorino

    Explicitly fail when hitting the multipart limit

    byroot authored spastorino committed
    Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Commits on Nov 7, 2014
  1. @tonyta
Commits on Oct 10, 2014
  1. @createdbypete

    Fix typo in comment

    createdbypete authored
Commits on Aug 3, 2014
  1. @raggi
  2. @raggi
  3. @raggi

    Merge pull request #697 from MichalBryxi/max_age

    raggi authored
    max-age settings forces Set-Cookie parameter
  4. @raggi

    Merge branch 'spastorino'

    raggi authored
    * spastorino:
      build_nested_query includes integer values
    
    Conflicts:
    	lib/rack/utils.rb
  5. @raggi

    build_nested_query includes integer values

    raggi authored
    Patch from @spastorino
    Closes #557
  6. @raggi

    Merge pull request #698 from IvanUkhov/build-query-empty-arrays

    raggi authored
    Utils.build_nested_query to handle empty arrays and hashes
Commits on Jul 18, 2014
  1. @raggi
  2. @rafaelfranca

    Raise specific exception if the parameters are invalid

    rafaelfranca authored
    There are some cases where we try to parse the parameters but it fails
    with ArgumentError.
    
    1. When the parameters come from the query string and contains invalid
    UTF-8 characters. In this case we raise ArgumentError when trying to
    match the key portion of parameters with a regexp.
    
    2. When the parameters come from the request body and the query string
    contains invalid % encoded string. In this case we raise ArgumentError
    when calling URI.decode_www_form_component.
    
    Now both cases raise a InvalidParameterError what inherit from TypeError
    and we can catch this exception to show a bad request for users instead
    of an internal server error.
Commits on Jul 14, 2014
  1. @raggi

    ParameterTypeError for parse_nested_query

    raggi authored
    Inherits from TypeError, so existing code that checks types by is_a? and friends
    should still work fine. This should enable users to be more confident that they
    are only catching this error case, not other exceptional conditions.
    
    Closes #524
Commits on Jul 13, 2014
  1. @raggi

    Gracefully handle cycles in parameters

    raggi authored
    Might close 632, pending more information.
Commits on Jul 6, 2014
  1. @raggi

    Merge pull request #675 from keithduncan/fix-clean-path-for-slash

    raggi authored
    Fix `clean_path_info` for paths with only a slash
  2. @raggi
Commits on Jul 5, 2014
  1. @raggi

    Merge pull request #659 from jodosha/utils-best_q_match-respect-conte…

    raggi authored
    …nt-type
    
    Ensure Rack::Utils.best_q_match to respect requested content type
Something went wrong with that request. Please try again.