rack 2.2.10 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack might be problematic. Click here for more details.

Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +138 -105
  3. data/CONTRIBUTING.md +53 -47
  4. data/MIT-LICENSE +1 -1
  5. data/README.md +287 -0
  6. data/Rakefile +40 -7
  7. data/SPEC.rdoc +166 -125
  8. data/contrib/LICENSE.md +7 -0
  9. data/contrib/logo.webp +0 -0
  10. data/lib/rack/auth/abstract/handler.rb +3 -1
  11. data/lib/rack/auth/abstract/request.rb +3 -1
  12. data/lib/rack/auth/basic.rb +2 -1
  13. data/lib/rack/auth/digest/md5.rb +1 -131
  14. data/lib/rack/auth/digest/nonce.rb +1 -53
  15. data/lib/rack/auth/digest/params.rb +1 -54
  16. data/lib/rack/auth/digest/request.rb +1 -43
  17. data/lib/rack/auth/digest.rb +256 -0
  18. data/lib/rack/body_proxy.rb +3 -1
  19. data/lib/rack/builder.rb +60 -42
  20. data/lib/rack/cascade.rb +2 -0
  21. data/lib/rack/chunked.rb +16 -13
  22. data/lib/rack/common_logger.rb +23 -18
  23. data/lib/rack/conditional_get.rb +18 -15
  24. data/lib/rack/constants.rb +62 -0
  25. data/lib/rack/content_length.rb +12 -16
  26. data/lib/rack/content_type.rb +8 -5
  27. data/lib/rack/deflater.rb +40 -26
  28. data/lib/rack/directory.rb +9 -3
  29. data/lib/rack/etag.rb +14 -23
  30. data/lib/rack/events.rb +4 -0
  31. data/lib/rack/file.rb +2 -0
  32. data/lib/rack/files.rb +15 -17
  33. data/lib/rack/head.rb +9 -8
  34. data/lib/rack/headers.rb +154 -0
  35. data/lib/rack/lint.rb +740 -649
  36. data/lib/rack/lock.rb +2 -5
  37. data/lib/rack/logger.rb +2 -0
  38. data/lib/rack/media_type.rb +4 -9
  39. data/lib/rack/method_override.rb +5 -1
  40. data/lib/rack/mime.rb +8 -0
  41. data/lib/rack/mock.rb +1 -271
  42. data/lib/rack/mock_request.rb +166 -0
  43. data/lib/rack/mock_response.rb +124 -0
  44. data/lib/rack/multipart/generator.rb +7 -5
  45. data/lib/rack/multipart/parser.rb +123 -85
  46. data/lib/rack/multipart/uploaded_file.rb +4 -0
  47. data/lib/rack/multipart.rb +20 -40
  48. data/lib/rack/null_logger.rb +9 -0
  49. data/lib/rack/query_parser.rb +76 -44
  50. data/lib/rack/recursive.rb +2 -0
  51. data/lib/rack/reloader.rb +0 -2
  52. data/lib/rack/request.rb +189 -91
  53. data/lib/rack/response.rb +131 -61
  54. data/lib/rack/rewindable_input.rb +24 -5
  55. data/lib/rack/runtime.rb +7 -6
  56. data/lib/rack/sendfile.rb +30 -25
  57. data/lib/rack/show_exceptions.rb +15 -2
  58. data/lib/rack/show_status.rb +17 -7
  59. data/lib/rack/static.rb +8 -8
  60. data/lib/rack/tempfile_reaper.rb +15 -4
  61. data/lib/rack/urlmap.rb +4 -2
  62. data/lib/rack/utils.rb +212 -202
  63. data/lib/rack/version.rb +9 -4
  64. data/lib/rack.rb +5 -76
  65. data/rack.gemspec +6 -6
  66. metadata +19 -31
  67. data/README.rdoc +0 -320
  68. data/bin/rackup +0 -5
  69. data/contrib/rack.png +0 -0
  70. data/contrib/rack.svg +0 -150
  71. data/contrib/rack_logo.svg +0 -164
  72. data/lib/rack/core_ext/regexp.rb +0 -14
  73. data/lib/rack/handler/cgi.rb +0 -59
  74. data/lib/rack/handler/fastcgi.rb +0 -100
  75. data/lib/rack/handler/lsws.rb +0 -61
  76. data/lib/rack/handler/scgi.rb +0 -71
  77. data/lib/rack/handler/thin.rb +0 -36
  78. data/lib/rack/handler/webrick.rb +0 -129
  79. data/lib/rack/handler.rb +0 -104
  80. data/lib/rack/lobster.rb +0 -70
  81. data/lib/rack/server.rb +0 -466
  82. data/lib/rack/session/abstract/id.rb +0 -523
  83. data/lib/rack/session/cookie.rb +0 -203
  84. data/lib/rack/session/memcache.rb +0 -10
  85. data/lib/rack/session/pool.rb +0 -85
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rack/session/dalli'
4
-
5
- module Rack
6
- module Session
7
- warn "Rack::Session::Memcache is deprecated, please use Rack::Session::Dalli from 'dalli' gem instead."
8
- Memcache = Dalli
9
- end
10
- end
@@ -1,85 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # AUTHOR: blink <blinketje@gmail.com>; blink#ruby-lang@irc.freenode.net
4
- # THANKS:
5
- # apeiros, for session id generation, expiry setup, and threadiness
6
- # sergio, threadiness and bugreps
7
-
8
- require_relative 'abstract/id'
9
- require 'thread'
10
-
11
- module Rack
12
- module Session
13
- # Rack::Session::Pool provides simple cookie based session management.
14
- # Session data is stored in a hash held by @pool.
15
- # In the context of a multithreaded environment, sessions being
16
- # committed to the pool is done in a merging manner.
17
- #
18
- # The :drop option is available in rack.session.options if you wish to
19
- # explicitly remove the session from the session cache.
20
- #
21
- # Example:
22
- # myapp = MyRackApp.new
23
- # sessioned = Rack::Session::Pool.new(myapp,
24
- # :domain => 'foo.com',
25
- # :expire_after => 2592000
26
- # )
27
- # Rack::Handler::WEBrick.run sessioned
28
-
29
- class Pool < Abstract::PersistedSecure
30
- attr_reader :mutex, :pool
31
- DEFAULT_OPTIONS = Abstract::ID::DEFAULT_OPTIONS.merge drop: false
32
-
33
- def initialize(app, options = {})
34
- super
35
- @pool = Hash.new
36
- @mutex = Mutex.new
37
- end
38
-
39
- def generate_sid
40
- loop do
41
- sid = super
42
- break sid unless @pool.key? sid.private_id
43
- end
44
- end
45
-
46
- def find_session(req, sid)
47
- with_lock(req) do
48
- unless sid and session = get_session_with_fallback(sid)
49
- sid, session = generate_sid, {}
50
- @pool.store sid.private_id, session
51
- end
52
- [sid, session]
53
- end
54
- end
55
-
56
- def write_session(req, session_id, new_session, options)
57
- with_lock(req) do
58
- @pool.store session_id.private_id, new_session
59
- session_id
60
- end
61
- end
62
-
63
- def delete_session(req, session_id, options)
64
- with_lock(req) do
65
- @pool.delete(session_id.public_id)
66
- @pool.delete(session_id.private_id)
67
- generate_sid unless options[:drop]
68
- end
69
- end
70
-
71
- def with_lock(req)
72
- @mutex.lock if req.multithread?
73
- yield
74
- ensure
75
- @mutex.unlock if @mutex.locked?
76
- end
77
-
78
- private
79
-
80
- def get_session_with_fallback(sid)
81
- @pool[sid.private_id] || @pool[sid.public_id]
82
- end
83
- end
84
- end
85
- end