acts-as-messageable 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/test.yml +152 -0
  4. data/.rubocop.yml +14 -1
  5. data/.rubocop_todo.yml +49 -7
  6. data/.ruby-version +1 -0
  7. data/Appraisals +11 -0
  8. data/Dockerfile +2 -1
  9. data/Gemfile +19 -13
  10. data/Gemfile.lock +186 -97
  11. data/README.md +2 -3
  12. data/Rakefile +6 -1
  13. data/VERSION +1 -1
  14. data/acts-as-messageable.gemspec +193 -40
  15. data/bin/tapioca +29 -0
  16. data/docker-compose.yml +82 -71
  17. data/gemfiles/rails_3.2.gemfile +14 -9
  18. data/gemfiles/rails_4.2.gemfile +14 -9
  19. data/gemfiles/rails_5.2.gemfile +14 -9
  20. data/gemfiles/rails_6.0.gemfile +14 -9
  21. data/gemfiles/rails_7.0.gemfile +29 -0
  22. data/gemfiles/rails_master.gemfile +15 -9
  23. data/lib/acts-as-messageable.rb +1 -0
  24. data/lib/acts_as_messageable/message.rb +62 -5
  25. data/lib/acts_as_messageable/model.rb +71 -20
  26. data/lib/acts_as_messageable/rails3.rb +27 -2
  27. data/lib/acts_as_messageable/rails4.rb +31 -4
  28. data/lib/acts_as_messageable/rails6.rb +34 -2
  29. data/lib/acts_as_messageable/railtie.rb +1 -0
  30. data/lib/acts_as_messageable/relation.rb +18 -2
  31. data/lib/acts_as_messageable/scopes.rb +11 -0
  32. data/lib/acts_as_messageable.rb +18 -0
  33. data/lib/generators/acts_as_messageable/migration/migration_generator.rb +4 -0
  34. data/lib/generators/acts_as_messageable/migration/templates/migration.rb +1 -0
  35. data/lib/generators/acts_as_messageable/migration/templates/migration_indexes.rb +1 -0
  36. data/lib/generators/acts_as_messageable/migration/templates/migration_opened_as_datetime.rb +1 -0
  37. data/lib/generators/acts_as_messageable/migration/templates/migration_permanent.rb +1 -0
  38. data/sorbet/config +4 -0
  39. data/sorbet/rbi/annotations/actionpack.rbi +428 -0
  40. data/sorbet/rbi/annotations/actionview.rbi +77 -0
  41. data/sorbet/rbi/annotations/activerecord.rbi +18 -0
  42. data/sorbet/rbi/annotations/activesupport.rbi +52 -0
  43. data/sorbet/rbi/annotations/faraday.rbi +17 -0
  44. data/sorbet/rbi/annotations/railties.rbi +58 -0
  45. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  46. data/sorbet/rbi/dsl/abstract_controller/caching/fragments.rbi +23 -0
  47. data/sorbet/rbi/dsl/abstract_controller/caching.rbi +30 -0
  48. data/sorbet/rbi/dsl/abstract_controller/callbacks.rbi +23 -0
  49. data/sorbet/rbi/dsl/abstract_controller/helpers.rbi +23 -0
  50. data/sorbet/rbi/dsl/abstract_controller/rendering.rbi +9 -0
  51. data/sorbet/rbi/dsl/abstract_controller/url_for.rbi +23 -0
  52. data/sorbet/rbi/dsl/action_controller/caching.rbi +29 -0
  53. data/sorbet/rbi/dsl/action_controller/conditional_get.rbi +23 -0
  54. data/sorbet/rbi/dsl/action_controller/content_security_policy.rbi +31 -0
  55. data/sorbet/rbi/dsl/action_controller/data_streaming.rbi +9 -0
  56. data/sorbet/rbi/dsl/action_controller/etag_with_flash.rbi +24 -0
  57. data/sorbet/rbi/dsl/action_controller/etag_with_template_digest.rbi +30 -0
  58. data/sorbet/rbi/dsl/action_controller/flash.rbi +19 -0
  59. data/sorbet/rbi/dsl/action_controller/form_builder.rbi +19 -0
  60. data/sorbet/rbi/dsl/action_controller/helpers.rbi +36 -0
  61. data/sorbet/rbi/dsl/action_controller/params_wrapper.rbi +23 -0
  62. data/sorbet/rbi/dsl/action_controller/redirecting.rbi +24 -0
  63. data/sorbet/rbi/dsl/action_controller/renderers/all.rbi +24 -0
  64. data/sorbet/rbi/dsl/action_controller/renderers.rbi +23 -0
  65. data/sorbet/rbi/dsl/action_controller/request_forgery_protection.rbi +31 -0
  66. data/sorbet/rbi/dsl/action_controller/rescue.rbi +24 -0
  67. data/sorbet/rbi/dsl/action_controller/test_case/behavior.rbi +24 -0
  68. data/sorbet/rbi/dsl/action_controller/url_for.rbi +24 -0
  69. data/sorbet/rbi/dsl/action_dispatch/routing/url_for.rbi +23 -0
  70. data/sorbet/rbi/dsl/action_view/helpers/form_helper.rbi +10 -0
  71. data/sorbet/rbi/dsl/action_view/helpers/form_tag_helper.rbi +10 -0
  72. data/sorbet/rbi/dsl/action_view/helpers/text_helper.rbi +9 -0
  73. data/sorbet/rbi/dsl/action_view/helpers.rbi +10 -0
  74. data/sorbet/rbi/dsl/action_view/layouts.rbi +24 -0
  75. data/sorbet/rbi/dsl/action_view/rendering.rbi +9 -0
  76. data/sorbet/rbi/dsl/active_model/attribute_methods.rbi +27 -0
  77. data/sorbet/rbi/dsl/active_model/attributes.rbi +34 -0
  78. data/sorbet/rbi/dsl/active_model/dirty.rbi +28 -0
  79. data/sorbet/rbi/dsl/active_model/serializers/json.rbi +22 -0
  80. data/sorbet/rbi/dsl/active_model/validations/callbacks.rbi +22 -0
  81. data/sorbet/rbi/dsl/active_model/validations.rbi +27 -0
  82. data/sorbet/rbi/dsl/active_record/attribute_methods/dirty.rbi +38 -0
  83. data/sorbet/rbi/dsl/active_record/attribute_methods/time_zone_conversion.rbi +32 -0
  84. data/sorbet/rbi/dsl/active_record/attribute_methods.rbi +53 -0
  85. data/sorbet/rbi/dsl/active_record/attributes.rbi +19 -0
  86. data/sorbet/rbi/dsl/active_record/callbacks.rbi +22 -0
  87. data/sorbet/rbi/dsl/active_record/core.rbi +55 -0
  88. data/sorbet/rbi/dsl/active_record/encryption/encryptable_record.rbi +23 -0
  89. data/sorbet/rbi/dsl/active_record/inheritance.rbi +27 -0
  90. data/sorbet/rbi/dsl/active_record/integration.rbi +32 -0
  91. data/sorbet/rbi/dsl/active_record/locking/optimistic.rbi +22 -0
  92. data/sorbet/rbi/dsl/active_record/model_schema.rbi +52 -0
  93. data/sorbet/rbi/dsl/active_record/nested_attributes.rbi +22 -0
  94. data/sorbet/rbi/dsl/active_record/readonly_attributes.rbi +19 -0
  95. data/sorbet/rbi/dsl/active_record/reflection.rbi +32 -0
  96. data/sorbet/rbi/dsl/active_record/scoping/default.rbi +23 -0
  97. data/sorbet/rbi/dsl/active_record/scoping.rbi +23 -0
  98. data/sorbet/rbi/dsl/active_record/serialization.rbi +22 -0
  99. data/sorbet/rbi/dsl/active_record/signed_id.rbi +22 -0
  100. data/sorbet/rbi/dsl/active_record/test_fixtures.rbi +58 -0
  101. data/sorbet/rbi/dsl/active_record/timestamp.rbi +23 -0
  102. data/sorbet/rbi/dsl/active_record/validations.rbi +28 -0
  103. data/sorbet/rbi/dsl/active_support/actionable_error.rbi +23 -0
  104. data/sorbet/rbi/dsl/active_support/callbacks.rbi +22 -0
  105. data/sorbet/rbi/dsl/active_support/rescuable.rbi +23 -0
  106. data/sorbet/rbi/dsl/active_support/testing/file_fixtures.rbi +22 -0
  107. data/sorbet/rbi/gems/actionpack@7.0.4.3.rbi +19265 -0
  108. data/sorbet/rbi/gems/actionview@7.0.4.3.rbi +15482 -0
  109. data/sorbet/rbi/gems/activemodel@7.0.4.3.rbi +6025 -0
  110. data/sorbet/rbi/gems/activerecord@7.0.4.3.rbi +37852 -0
  111. data/sorbet/rbi/gems/activesupport@7.0.4.3.rbi +18788 -0
  112. data/sorbet/rbi/gems/addressable@2.4.0.rbi +8 -0
  113. data/sorbet/rbi/gems/appraisal@2.4.1.rbi +584 -0
  114. data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
  115. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  116. data/sorbet/rbi/gems/coderay@1.1.3.rbi +3426 -0
  117. data/sorbet/rbi/gems/commander@4.6.0.rbi +8 -0
  118. data/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi +11545 -0
  119. data/sorbet/rbi/gems/coveralls_reborn@0.27.0.rbi +8 -0
  120. data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
  121. data/sorbet/rbi/gems/descendants_tracker@0.0.4.rbi +8 -0
  122. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  123. data/sorbet/rbi/gems/docile@1.4.0.rbi +8 -0
  124. data/sorbet/rbi/gems/erubi@1.12.0.rbi +146 -0
  125. data/sorbet/rbi/gems/faraday@0.9.2.rbi +964 -0
  126. data/sorbet/rbi/gems/git@1.11.0.rbi +2700 -0
  127. data/sorbet/rbi/gems/github_api@0.16.0.rbi +8 -0
  128. data/sorbet/rbi/gems/hashie@5.0.0.rbi +8 -0
  129. data/sorbet/rbi/gems/highline@2.0.3.rbi +8 -0
  130. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  131. data/sorbet/rbi/gems/jeweler@2.3.9.rbi +1591 -0
  132. data/sorbet/rbi/gems/json@2.6.3.rbi +1541 -0
  133. data/sorbet/rbi/gems/jwt@2.5.0.rbi +8 -0
  134. data/sorbet/rbi/gems/loofah@2.19.1.rbi +904 -0
  135. data/sorbet/rbi/gems/method_source@1.0.0.rbi +272 -0
  136. data/sorbet/rbi/gems/mime-types@2.99.3.rbi +8 -0
  137. data/sorbet/rbi/gems/minitest@5.18.0.rbi +1491 -0
  138. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +8 -0
  139. data/sorbet/rbi/gems/multi_xml@0.6.0.rbi +8 -0
  140. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +8 -0
  141. data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
  142. data/sorbet/rbi/gems/nokogiri@1.14.2.rbi +7244 -0
  143. data/sorbet/rbi/gems/oauth2@1.4.8.rbi +8 -0
  144. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  145. data/sorbet/rbi/gems/pg@1.4.6.rbi +2574 -0
  146. data/sorbet/rbi/gems/polyfill@1.9.0.rbi +8 -0
  147. data/sorbet/rbi/gems/pry@0.14.2.rbi +10081 -0
  148. data/sorbet/rbi/gems/psych@4.0.6.rbi +1819 -0
  149. data/sorbet/rbi/gems/racc@1.6.2.rbi +155 -0
  150. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +943 -0
  151. data/sorbet/rbi/gems/rack@2.2.6.4.rbi +5659 -0
  152. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +455 -0
  153. data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +685 -0
  154. data/sorbet/rbi/gems/railties@7.0.4.3.rbi +4553 -0
  155. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +8 -0
  156. data/sorbet/rbi/gems/rake@13.0.6.rbi +2959 -0
  157. data/sorbet/rbi/gems/rbi@0.0.16.rbi +3008 -0
  158. data/sorbet/rbi/gems/rbs@2.8.0.rbi +8 -0
  159. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +1078 -0
  160. data/sorbet/rbi/gems/rdoc@6.5.0.rbi +12441 -0
  161. data/sorbet/rbi/gems/regexp_parser@2.7.0.rbi +8 -0
  162. data/sorbet/rbi/gems/rexml@3.2.5.rbi +8 -0
  163. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +10798 -0
  164. data/sorbet/rbi/gems/rspec-expectations@3.12.0.rbi +8090 -0
  165. data/sorbet/rbi/gems/rspec-mocks@3.12.0.rbi +5296 -0
  166. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +1617 -0
  167. data/sorbet/rbi/gems/rspec@3.12.0.rbi +88 -0
  168. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +8 -0
  169. data/sorbet/rbi/gems/safe_type@1.1.1.rbi +8 -0
  170. data/sorbet/rbi/gems/semver2@3.4.2.rbi +8 -0
  171. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +8 -0
  172. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +8 -0
  173. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +8 -0
  174. data/sorbet/rbi/gems/sorbet-coerce@0.7.0.rbi +8 -0
  175. data/sorbet/rbi/gems/stringio@3.0.2.rbi +8 -0
  176. data/sorbet/rbi/gems/sync@0.5.0.rbi +8 -0
  177. data/sorbet/rbi/gems/term-ansicolor@1.7.1.rbi +8 -0
  178. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  179. data/sorbet/rbi/gems/thread_safe@0.3.6.rbi +8 -0
  180. data/sorbet/rbi/gems/timecop@0.9.6.rbi +361 -0
  181. data/sorbet/rbi/gems/tins@1.32.1.rbi +8 -0
  182. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5917 -0
  183. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +8 -0
  184. data/sorbet/rbi/gems/unparser@0.6.7.rbi +4515 -0
  185. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2553 -0
  186. data/sorbet/rbi/gems/yard@0.9.28.rbi +17954 -0
  187. data/sorbet/rbi/gems/zeitwerk@2.6.7.rbi +966 -0
  188. data/sorbet/rbi/models/acts-as-messageable/message.rbi +668 -0
  189. data/sorbet/rbi/models/acts-as-messageable/user.rbi +343 -0
  190. data/sorbet/rbi/rails-rbi/active_record_base.rbi +119 -0
  191. data/sorbet/rbi/rails-rbi/active_record_relation.rbi +180 -0
  192. data/sorbet/rbi/shims/activerecord.rbi +4 -0
  193. data/sorbet/rbi/shims/model.rbi +9 -0
  194. data/sorbet/tapioca/config.yml +10 -0
  195. data/sorbet/tapioca/pre_require.rb +5 -0
  196. data/sorbet/tapioca/require.rb +10 -0
  197. data/spec/acts_as_messageable_spec.rb +7 -4
  198. data/spec/custom_class_spec.rb +1 -0
  199. data/spec/custom_required_spec.rb +8 -4
  200. data/spec/group_messages_spec.rb +1 -0
  201. data/spec/migrations_spec.rb +2 -1
  202. data/spec/spec_helper.rb +19 -9
  203. data/spec/support/admin.rb +3 -0
  204. data/spec/support/custom_message.rb +3 -0
  205. data/spec/support/custom_message_uuid.rb +1 -0
  206. data/spec/support/custom_search_user.rb +3 -0
  207. data/spec/support/men.rb +1 -0
  208. data/spec/support/send_message.rb +8 -1
  209. data/spec/support/table_schema.rb +7 -6
  210. data/spec/support/user.rb +3 -0
  211. data/spec/support/uuid_user.rb +3 -0
  212. data/tasks/types.rake +46 -0
  213. metadata +261 -11
  214. data/.travis.yml +0 -55
@@ -0,0 +1,2553 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `webrick` gem.
5
+ # Please instead update this file by running `bin/tapioca gem webrick`.
6
+
7
+ # AccessLog provides logging to various files in various formats.
8
+ #
9
+ # Multiple logs may be written to at the same time:
10
+ #
11
+ # access_log = [
12
+ # [$stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT],
13
+ # [$stderr, WEBrick::AccessLog::REFERER_LOG_FORMAT],
14
+ # ]
15
+ #
16
+ # server = WEBrick::HTTPServer.new :AccessLog => access_log
17
+ #
18
+ # Custom log formats may be defined. WEBrick::AccessLog provides a subset
19
+ # of the formatting from Apache's mod_log_config
20
+ # http://httpd.apache.org/docs/mod/mod_log_config.html#formats. See
21
+ # AccessLog::setup_params for a list of supported options
22
+ #
23
+ # source://webrick//lib/webrick/accesslog.rb#30
24
+ module WEBrick::AccessLog
25
+ private
26
+
27
+ # Escapes control characters in +data+
28
+ #
29
+ # source://webrick//lib/webrick/accesslog.rb#151
30
+ def escape(data); end
31
+
32
+ # Formats +params+ according to +format_string+ which is described in
33
+ # setup_params.
34
+ #
35
+ # source://webrick//lib/webrick/accesslog.rb#123
36
+ def format(format_string, params); end
37
+
38
+ # This format specification is a subset of mod_log_config of Apache:
39
+ #
40
+ # %a:: Remote IP address
41
+ # %b:: Total response size
42
+ # %e{variable}:: Given variable in ENV
43
+ # %f:: Response filename
44
+ # %h:: Remote host name
45
+ # %{header}i:: Given request header
46
+ # %l:: Remote logname, always "-"
47
+ # %m:: Request method
48
+ # %{attr}n:: Given request attribute from <tt>req.attributes</tt>
49
+ # %{header}o:: Given response header
50
+ # %p:: Server's request port
51
+ # %{format}p:: The canonical port of the server serving the request or the
52
+ # actual port or the client's actual port. Valid formats are
53
+ # canonical, local or remote.
54
+ # %q:: Request query string
55
+ # %r:: First line of the request
56
+ # %s:: Request status
57
+ # %t:: Time the request was received
58
+ # %T:: Time taken to process the request
59
+ # %u:: Remote user from auth
60
+ # %U:: Unparsed URI
61
+ # %%:: Literal %
62
+ #
63
+ # source://webrick//lib/webrick/accesslog.rb#95
64
+ def setup_params(config, req, res); end
65
+
66
+ class << self
67
+ # Escapes control characters in +data+
68
+ #
69
+ # source://webrick//lib/webrick/accesslog.rb#151
70
+ def escape(data); end
71
+
72
+ # Formats +params+ according to +format_string+ which is described in
73
+ # setup_params.
74
+ #
75
+ # source://webrick//lib/webrick/accesslog.rb#123
76
+ def format(format_string, params); end
77
+
78
+ # This format specification is a subset of mod_log_config of Apache:
79
+ #
80
+ # %a:: Remote IP address
81
+ # %b:: Total response size
82
+ # %e{variable}:: Given variable in ENV
83
+ # %f:: Response filename
84
+ # %h:: Remote host name
85
+ # %{header}i:: Given request header
86
+ # %l:: Remote logname, always "-"
87
+ # %m:: Request method
88
+ # %{attr}n:: Given request attribute from <tt>req.attributes</tt>
89
+ # %{header}o:: Given response header
90
+ # %p:: Server's request port
91
+ # %{format}p:: The canonical port of the server serving the request or the
92
+ # actual port or the client's actual port. Valid formats are
93
+ # canonical, local or remote.
94
+ # %q:: Request query string
95
+ # %r:: First line of the request
96
+ # %s:: Request status
97
+ # %t:: Time the request was received
98
+ # %T:: Time taken to process the request
99
+ # %u:: Remote user from auth
100
+ # %U:: Unparsed URI
101
+ # %%:: Literal %
102
+ #
103
+ # source://webrick//lib/webrick/accesslog.rb#95
104
+ def setup_params(config, req, res); end
105
+ end
106
+ end
107
+
108
+ # A generic logging class
109
+ #
110
+ # source://webrick//lib/webrick/log.rb#17
111
+ class WEBrick::BasicLog
112
+ # Initializes a new logger for +log_file+ that outputs messages at +level+
113
+ # or higher. +log_file+ can be a filename, an IO-like object that
114
+ # responds to #<< or nil which outputs to $stderr.
115
+ #
116
+ # If no level is given INFO is chosen by default
117
+ #
118
+ # @return [BasicLog] a new instance of BasicLog
119
+ #
120
+ # source://webrick//lib/webrick/log.rb#50
121
+ def initialize(log_file = T.unsafe(nil), level = T.unsafe(nil)); end
122
+
123
+ # Synonym for log(INFO, obj.to_s)
124
+ #
125
+ # source://webrick//lib/webrick/log.rb#84
126
+ def <<(obj); end
127
+
128
+ # Closes the logger (also closes the log device associated to the logger)
129
+ #
130
+ # source://webrick//lib/webrick/log.rb#66
131
+ def close; end
132
+
133
+ # Shortcut for logging a DEBUG message
134
+ #
135
+ # source://webrick//lib/webrick/log.rb#97
136
+ def debug(msg); end
137
+
138
+ # Will the logger output DEBUG messages?
139
+ #
140
+ # @return [Boolean]
141
+ #
142
+ # source://webrick//lib/webrick/log.rb#108
143
+ def debug?; end
144
+
145
+ # Shortcut for logging an ERROR message
146
+ #
147
+ # source://webrick//lib/webrick/log.rb#91
148
+ def error(msg); end
149
+
150
+ # Will the logger output ERROR messages?
151
+ #
152
+ # @return [Boolean]
153
+ #
154
+ # source://webrick//lib/webrick/log.rb#102
155
+ def error?; end
156
+
157
+ # Shortcut for logging a FATAL message
158
+ #
159
+ # source://webrick//lib/webrick/log.rb#89
160
+ def fatal(msg); end
161
+
162
+ # Will the logger output FATAL messages?
163
+ #
164
+ # @return [Boolean]
165
+ #
166
+ # source://webrick//lib/webrick/log.rb#100
167
+ def fatal?; end
168
+
169
+ # Shortcut for logging an INFO message
170
+ #
171
+ # source://webrick//lib/webrick/log.rb#95
172
+ def info(msg); end
173
+
174
+ # Will the logger output INFO messages?
175
+ #
176
+ # @return [Boolean]
177
+ #
178
+ # source://webrick//lib/webrick/log.rb#106
179
+ def info?; end
180
+
181
+ # log-level, messages above this level will be logged
182
+ #
183
+ # source://webrick//lib/webrick/log.rb#41
184
+ def level; end
185
+
186
+ # log-level, messages above this level will be logged
187
+ #
188
+ # source://webrick//lib/webrick/log.rb#41
189
+ def level=(_arg0); end
190
+
191
+ # Logs +data+ at +level+ if the given level is above the current log
192
+ # level.
193
+ #
194
+ # source://webrick//lib/webrick/log.rb#75
195
+ def log(level, data); end
196
+
197
+ # Shortcut for logging a WARN message
198
+ #
199
+ # source://webrick//lib/webrick/log.rb#93
200
+ def warn(msg); end
201
+
202
+ # Will the logger output WARN messages?
203
+ #
204
+ # @return [Boolean]
205
+ #
206
+ # source://webrick//lib/webrick/log.rb#104
207
+ def warn?; end
208
+
209
+ private
210
+
211
+ # Formats +arg+ for the logger
212
+ #
213
+ # * If +arg+ is an Exception, it will format the error message and
214
+ # the back trace.
215
+ # * If +arg+ responds to #to_str, it will return it.
216
+ # * Otherwise it will return +arg+.inspect.
217
+ #
218
+ # source://webrick//lib/webrick/log.rb#119
219
+ def format(arg); end
220
+ end
221
+
222
+ # --
223
+ # Updates WEBrick::GenericServer with SSL functionality
224
+ #
225
+ # source://webrick//lib/webrick/server.rb#56
226
+ class WEBrick::GenericServer
227
+ # Creates a new generic server from +config+. The default configuration
228
+ # comes from +default+.
229
+ #
230
+ # @return [GenericServer] a new instance of GenericServer
231
+ #
232
+ # source://webrick//lib/webrick/server.rb#88
233
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
234
+
235
+ # Retrieves +key+ from the configuration
236
+ #
237
+ # source://webrick//lib/webrick/server.rb#121
238
+ def [](key); end
239
+
240
+ # The server configuration
241
+ #
242
+ # source://webrick//lib/webrick/server.rb#66
243
+ def config; end
244
+
245
+ # Updates +listen+ to enable SSL when the SSL configuration is active.
246
+ #
247
+ # source://webrick//lib/webrick/server.rb#129
248
+ def listen(address, port); end
249
+
250
+ # Sockets listening for connections.
251
+ #
252
+ # source://webrick//lib/webrick/server.rb#82
253
+ def listeners; end
254
+
255
+ # The server logger. This is independent from the HTTP access log.
256
+ #
257
+ # source://webrick//lib/webrick/server.rb#71
258
+ def logger; end
259
+
260
+ # You must subclass GenericServer and implement \#run which accepts a TCP
261
+ # client socket
262
+ #
263
+ # source://webrick//lib/webrick/server.rb#244
264
+ def run(sock); end
265
+
266
+ # Shuts down the server and all listening sockets. New listeners must be
267
+ # provided to restart the server.
268
+ #
269
+ # source://webrick//lib/webrick/server.rb#234
270
+ def shutdown; end
271
+
272
+ # Starts the server and runs the +block+ for each connection. This method
273
+ # does not return until the server is stopped from a signal handler or
274
+ # another thread using #stop or #shutdown.
275
+ #
276
+ # If the block raises a subclass of StandardError the exception is logged
277
+ # and ignored. If an IOError or Errno::EBADF exception is raised the
278
+ # exception is ignored. If an Exception subclass is raised the exception
279
+ # is logged and re-raised which stops the server.
280
+ #
281
+ # To completely shut down a server call #shutdown from ensure:
282
+ #
283
+ # server = WEBrick::GenericServer.new
284
+ # # or WEBrick::HTTPServer.new
285
+ #
286
+ # begin
287
+ # server.start
288
+ # ensure
289
+ # server.shutdown
290
+ # end
291
+ #
292
+ # @raise [ServerError]
293
+ #
294
+ # source://webrick//lib/webrick/server.rb#154
295
+ def start(&block); end
296
+
297
+ # The server status. One of :Stop, :Running or :Shutdown
298
+ #
299
+ # source://webrick//lib/webrick/server.rb#61
300
+ def status; end
301
+
302
+ # Stops the server from accepting new connections.
303
+ #
304
+ # source://webrick//lib/webrick/server.rb#222
305
+ def stop; end
306
+
307
+ # Tokens control the number of outstanding clients. The
308
+ # <code>:MaxClients</code> configuration sets this.
309
+ #
310
+ # source://webrick//lib/webrick/server.rb#77
311
+ def tokens; end
312
+
313
+ private
314
+
315
+ # Accepts a TCP client socket from the TCP server socket +svr+ and returns
316
+ # the client socket.
317
+ #
318
+ # source://webrick//lib/webrick/server.rb#256
319
+ def accept_client(svr); end
320
+
321
+ # source://webrick//lib/webrick/server.rb#347
322
+ def alarm_shutdown_pipe; end
323
+
324
+ # Calls the callback +callback_name+ from the configuration with +args+
325
+ #
326
+ # source://webrick//lib/webrick/server.rb#334
327
+ def call_callback(callback_name, *args); end
328
+
329
+ # source://webrick//lib/webrick/server.rb#359
330
+ def cleanup_listener; end
331
+
332
+ # source://webrick//lib/webrick/server.rb#342
333
+ def cleanup_shutdown_pipe(shutdown_pipe); end
334
+
335
+ # source://webrick//lib/webrick/server.rb#338
336
+ def setup_shutdown_pipe; end
337
+
338
+ # Starts a server thread for the client socket +sock+ that runs the given
339
+ # +block+.
340
+ #
341
+ # Sets the socket to the <code>:WEBrickSocket</code> thread local variable
342
+ # in the thread.
343
+ #
344
+ # If any errors occur in the block they are logged and handled.
345
+ #
346
+ # source://webrick//lib/webrick/server.rb#288
347
+ def start_thread(sock, &block); end
348
+ end
349
+
350
+ # source://webrick//lib/webrick/htmlutils.rb#13
351
+ module WEBrick::HTMLUtils
352
+ private
353
+
354
+ # Escapes &, ", > and < in +string+
355
+ #
356
+ # source://webrick//lib/webrick/htmlutils.rb#18
357
+ def escape(string); end
358
+
359
+ class << self
360
+ # Escapes &, ", > and < in +string+
361
+ #
362
+ # source://webrick//lib/webrick/htmlutils.rb#18
363
+ def escape(string); end
364
+ end
365
+ end
366
+
367
+ # HTTPAuth provides both basic and digest authentication.
368
+ #
369
+ # To enable authentication for requests in WEBrick you will need a user
370
+ # database and an authenticator. To start, here's an Htpasswd database for
371
+ # use with a DigestAuth authenticator:
372
+ #
373
+ # config = { :Realm => 'DigestAuth example realm' }
374
+ #
375
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
376
+ # htpasswd.auth_type = WEBrick::HTTPAuth::DigestAuth
377
+ # htpasswd.set_passwd config[:Realm], 'username', 'password'
378
+ # htpasswd.flush
379
+ #
380
+ # The +:Realm+ is used to provide different access to different groups
381
+ # across several resources on a server. Typically you'll need only one
382
+ # realm for a server.
383
+ #
384
+ # This database can be used to create an authenticator:
385
+ #
386
+ # config[:UserDB] = htpasswd
387
+ #
388
+ # digest_auth = WEBrick::HTTPAuth::DigestAuth.new config
389
+ #
390
+ # To authenticate a request call #authenticate with a request and response
391
+ # object in a servlet:
392
+ #
393
+ # def do_GET req, res
394
+ # @authenticator.authenticate req, res
395
+ # end
396
+ #
397
+ # For digest authentication the authenticator must not be created every
398
+ # request, it must be passed in as an option via WEBrick::HTTPServer#mount.
399
+ #
400
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#12
401
+ module WEBrick::HTTPAuth
402
+ private
403
+
404
+ # source://webrick//lib/webrick/httpauth.rb#57
405
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
406
+
407
+ # Simple wrapper for providing basic authentication for a request. When
408
+ # called with a request +req+, response +res+, authentication +realm+ and
409
+ # +block+ the block will be called with a +username+ and +password+. If
410
+ # the block returns true the request is allowed to continue, otherwise an
411
+ # HTTPStatus::Unauthorized error is raised.
412
+ #
413
+ # source://webrick//lib/webrick/httpauth.rb#79
414
+ def basic_auth(req, res, realm, &block); end
415
+
416
+ # Simple wrapper for providing basic authentication for a proxied request.
417
+ # When called with a request +req+, response +res+, authentication +realm+
418
+ # and +block+ the block will be called with a +username+ and +password+.
419
+ # If the block returns true the request is allowed to continue, otherwise
420
+ # an HTTPStatus::ProxyAuthenticationRequired error is raised.
421
+ #
422
+ # source://webrick//lib/webrick/httpauth.rb#91
423
+ def proxy_basic_auth(req, res, realm, &block); end
424
+
425
+ class << self
426
+ # source://webrick//lib/webrick/httpauth.rb#57
427
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
428
+
429
+ # Simple wrapper for providing basic authentication for a request. When
430
+ # called with a request +req+, response +res+, authentication +realm+ and
431
+ # +block+ the block will be called with a +username+ and +password+. If
432
+ # the block returns true the request is allowed to continue, otherwise an
433
+ # HTTPStatus::Unauthorized error is raised.
434
+ #
435
+ # source://webrick//lib/webrick/httpauth.rb#79
436
+ def basic_auth(req, res, realm, &block); end
437
+
438
+ # Simple wrapper for providing basic authentication for a proxied request.
439
+ # When called with a request +req+, response +res+, authentication +realm+
440
+ # and +block+ the block will be called with a +username+ and +password+.
441
+ # If the block returns true the request is allowed to continue, otherwise
442
+ # an HTTPStatus::ProxyAuthenticationRequired error is raised.
443
+ #
444
+ # source://webrick//lib/webrick/httpauth.rb#91
445
+ def proxy_basic_auth(req, res, realm, &block); end
446
+ end
447
+ end
448
+
449
+ # Module providing generic support for both Digest and Basic
450
+ # authentication schemes.
451
+ #
452
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#18
453
+ module WEBrick::HTTPAuth::Authenticator
454
+ # The logger for this authenticator
455
+ #
456
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#43
457
+ def logger; end
458
+
459
+ # The realm this authenticator covers
460
+ #
461
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#33
462
+ def realm; end
463
+
464
+ # The user database for this authenticator
465
+ #
466
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#38
467
+ def userdb; end
468
+
469
+ private
470
+
471
+ # Initializes the authenticator from +config+
472
+ #
473
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#52
474
+ def check_init(config); end
475
+
476
+ # Ensures +req+ has credentials that can be authenticated.
477
+ #
478
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#72
479
+ def check_scheme(req); end
480
+
481
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#91
482
+ def error(fmt, *args); end
483
+
484
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#97
485
+ def info(fmt, *args); end
486
+
487
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#85
488
+ def log(meth, fmt, *args); end
489
+ end
490
+
491
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#23
492
+ WEBrick::HTTPAuth::Authenticator::AuthException = WEBrick::HTTPStatus::Unauthorized
493
+
494
+ # Basic Authentication for WEBrick
495
+ #
496
+ # Use this class to add basic authentication to a WEBrick servlet.
497
+ #
498
+ # Here is an example of how to set up a BasicAuth:
499
+ #
500
+ # config = { :Realm => 'BasicAuth example realm' }
501
+ #
502
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file', password_hash: :bcrypt
503
+ # htpasswd.set_passwd config[:Realm], 'username', 'password'
504
+ # htpasswd.flush
505
+ #
506
+ # config[:UserDB] = htpasswd
507
+ #
508
+ # basic_auth = WEBrick::HTTPAuth::BasicAuth.new config
509
+ #
510
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#35
511
+ class WEBrick::HTTPAuth::BasicAuth
512
+ include ::WEBrick::HTTPAuth::Authenticator
513
+
514
+ # Creates a new BasicAuth instance.
515
+ #
516
+ # See WEBrick::Config::BasicAuth for default configuration entries
517
+ #
518
+ # You must supply the following configuration entries:
519
+ #
520
+ # :Realm:: The name of the realm being protected.
521
+ # :UserDB:: A database of usernames and passwords.
522
+ # A WEBrick::HTTPAuth::Htpasswd instance should be used.
523
+ #
524
+ # @return [BasicAuth] a new instance of BasicAuth
525
+ #
526
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#61
527
+ def initialize(config, default = T.unsafe(nil)); end
528
+
529
+ # Authenticates a +req+ and returns a 401 Unauthorized using +res+ if
530
+ # the authentication was not correct.
531
+ #
532
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#70
533
+ def authenticate(req, res); end
534
+
535
+ # Returns a challenge response which asks for authentication information
536
+ #
537
+ # @raise [@auth_exception]
538
+ #
539
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#103
540
+ def challenge(req, res); end
541
+
542
+ # Returns the value of attribute logger.
543
+ #
544
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#48
545
+ def logger; end
546
+
547
+ # Returns the value of attribute realm.
548
+ #
549
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#48
550
+ def realm; end
551
+
552
+ # Returns the value of attribute userdb.
553
+ #
554
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#48
555
+ def userdb; end
556
+
557
+ class << self
558
+ # Used by UserDB to create a basic password entry
559
+ #
560
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#43
561
+ def make_passwd(realm, user, pass); end
562
+ end
563
+ end
564
+
565
+ # RFC 2617 Digest Access Authentication for WEBrick
566
+ #
567
+ # Use this class to add digest authentication to a WEBrick servlet.
568
+ #
569
+ # Here is an example of how to set up DigestAuth:
570
+ #
571
+ # config = { :Realm => 'DigestAuth example realm' }
572
+ #
573
+ # htdigest = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
574
+ # htdigest.set_passwd config[:Realm], 'username', 'password'
575
+ # htdigest.flush
576
+ #
577
+ # config[:UserDB] = htdigest
578
+ #
579
+ # digest_auth = WEBrick::HTTPAuth::DigestAuth.new config
580
+ #
581
+ # When using this as with a servlet be sure not to create a new DigestAuth
582
+ # object in the servlet's #initialize. By default WEBrick creates a new
583
+ # servlet instance for every request and the DigestAuth object must be
584
+ # used across requests.
585
+ #
586
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#46
587
+ class WEBrick::HTTPAuth::DigestAuth
588
+ include ::WEBrick::HTTPAuth::Authenticator
589
+
590
+ # Creates a new DigestAuth instance. Be sure to use the same DigestAuth
591
+ # instance for multiple requests as it saves state between requests in
592
+ # order to perform authentication.
593
+ #
594
+ # See WEBrick::Config::DigestAuth for default configuration entries
595
+ #
596
+ # You must supply the following configuration entries:
597
+ #
598
+ # :Realm:: The name of the realm being protected.
599
+ # :UserDB:: A database of usernames and passwords.
600
+ # A WEBrick::HTTPAuth::Htdigest instance should be used.
601
+ #
602
+ # @return [DigestAuth] a new instance of DigestAuth
603
+ #
604
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#87
605
+ def initialize(config, default = T.unsafe(nil)); end
606
+
607
+ # Digest authentication algorithm
608
+ #
609
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#59
610
+ def algorithm; end
611
+
612
+ # Authenticates a +req+ and returns a 401 Unauthorized using +res+ if
613
+ # the authentication was not correct.
614
+ #
615
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#121
616
+ def authenticate(req, res); end
617
+
618
+ # Returns a challenge response which asks for authentication information
619
+ #
620
+ # @raise [@auth_exception]
621
+ #
622
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#134
623
+ def challenge(req, res, stale = T.unsafe(nil)); end
624
+
625
+ # Quality of protection. RFC 2617 defines "auth" and "auth-int"
626
+ #
627
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#64
628
+ def qop; end
629
+
630
+ private
631
+
632
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#163
633
+ def _authenticate(req, res); end
634
+
635
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#306
636
+ def check_nonce(req, auth_req); end
637
+
638
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#349
639
+ def check_opaque(opaque_struct, req, auth_req); end
640
+
641
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#365
642
+ def check_uri(req, auth_req); end
643
+
644
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#299
645
+ def generate_next_nonce(req); end
646
+
647
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#332
648
+ def generate_opaque(req); end
649
+
650
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#376
651
+ def hexdigest(*args); end
652
+
653
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#291
654
+ def split_param_value(string); end
655
+
656
+ class << self
657
+ # Used by UserDB to create a digest password entry
658
+ #
659
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#69
660
+ def make_passwd(realm, user, pass); end
661
+ end
662
+ end
663
+
664
+ # Htdigest accesses apache-compatible digest password files. Passwords are
665
+ # matched to a realm where they are valid. For security, the path for a
666
+ # digest password database should be stored outside of the paths available
667
+ # to the HTTP server.
668
+ #
669
+ # Htdigest is intended for use with WEBrick::HTTPAuth::DigestAuth and
670
+ # stores passwords using cryptographic hashes.
671
+ #
672
+ # htpasswd = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
673
+ # htpasswd.set_passwd 'my realm', 'username', 'password'
674
+ # htpasswd.flush
675
+ #
676
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#31
677
+ class WEBrick::HTTPAuth::Htdigest
678
+ include ::WEBrick::HTTPAuth::UserDB
679
+
680
+ # Open a digest password database at +path+
681
+ #
682
+ # @return [Htdigest] a new instance of Htdigest
683
+ #
684
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#37
685
+ def initialize(path); end
686
+
687
+ # Removes a password from the database for +user+ in +realm+.
688
+ #
689
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#113
690
+ def delete_passwd(realm, user); end
691
+
692
+ # Iterate passwords in the database.
693
+ #
694
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#122
695
+ def each; end
696
+
697
+ # Flush the password database. If +output+ is given the database will
698
+ # be written there instead of to the original path.
699
+ #
700
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#72
701
+ def flush(output = T.unsafe(nil)); end
702
+
703
+ # Retrieves a password from the database for +user+ in +realm+. If
704
+ # +reload_db+ is true the database will be reloaded first.
705
+ #
706
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#91
707
+ def get_passwd(realm, user, reload_db); end
708
+
709
+ # Reloads passwords from the database
710
+ #
711
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#50
712
+ def reload; end
713
+
714
+ # Sets a password in the database for +user+ in +realm+ to +pass+.
715
+ #
716
+ # source://webrick//lib/webrick/httpauth/htdigest.rb#101
717
+ def set_passwd(realm, user, pass); end
718
+ end
719
+
720
+ # Htgroup accesses apache-compatible group files. Htgroup can be used to
721
+ # provide group-based authentication for users. Currently Htgroup is not
722
+ # directly integrated with any authenticators in WEBrick. For security,
723
+ # the path for a digest password database should be stored outside of the
724
+ # paths available to the HTTP server.
725
+ #
726
+ # Example:
727
+ #
728
+ # htgroup = WEBrick::HTTPAuth::Htgroup.new 'my_group_file'
729
+ # htgroup.add 'superheroes', %w[spiderman batman]
730
+ #
731
+ # htgroup.members('superheroes').include? 'magneto' # => false
732
+ #
733
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#30
734
+ class WEBrick::HTTPAuth::Htgroup
735
+ # Open a group database at +path+
736
+ #
737
+ # @return [Htgroup] a new instance of Htgroup
738
+ #
739
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#35
740
+ def initialize(path); end
741
+
742
+ # Add an Array of +members+ to +group+
743
+ #
744
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#92
745
+ def add(group, members); end
746
+
747
+ # Flush the group database. If +output+ is given the database will be
748
+ # written there instead of to the original path.
749
+ #
750
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#64
751
+ def flush(output = T.unsafe(nil)); end
752
+
753
+ # Retrieve the list of members from +group+
754
+ #
755
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#84
756
+ def members(group); end
757
+
758
+ # Reload groups from the database
759
+ #
760
+ # source://webrick//lib/webrick/httpauth/htgroup.rb#46
761
+ def reload; end
762
+ end
763
+
764
+ # Htpasswd accesses apache-compatible password files. Passwords are
765
+ # matched to a realm where they are valid. For security, the path for a
766
+ # password database should be stored outside of the paths available to the
767
+ # HTTP server.
768
+ #
769
+ # Htpasswd is intended for use with WEBrick::HTTPAuth::BasicAuth.
770
+ #
771
+ # To create an Htpasswd database with a single user:
772
+ #
773
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
774
+ # htpasswd.set_passwd 'my realm', 'username', 'password'
775
+ # htpasswd.flush
776
+ #
777
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#32
778
+ class WEBrick::HTTPAuth::Htpasswd
779
+ include ::WEBrick::HTTPAuth::UserDB
780
+
781
+ # Open a password database at +path+
782
+ #
783
+ # @return [Htpasswd] a new instance of Htpasswd
784
+ #
785
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#38
786
+ def initialize(path, password_hash: T.unsafe(nil)); end
787
+
788
+ # Removes a password from the database for +user+ in +realm+.
789
+ #
790
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#144
791
+ def delete_passwd(realm, user); end
792
+
793
+ # Iterate passwords in the database.
794
+ #
795
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#151
796
+ def each; end
797
+
798
+ # Flush the password database. If +output+ is given the database will
799
+ # be written there instead of to the original path.
800
+ #
801
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#103
802
+ def flush(output = T.unsafe(nil)); end
803
+
804
+ # Retrieves a password from the database for +user+ in +realm+. If
805
+ # +reload_db+ is true the database will be reloaded first.
806
+ #
807
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#122
808
+ def get_passwd(realm, user, reload_db); end
809
+
810
+ # Reload passwords from the database
811
+ #
812
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#68
813
+ def reload; end
814
+
815
+ # Sets a password in the database for +user+ in +realm+ to +pass+.
816
+ #
817
+ # source://webrick//lib/webrick/httpauth/htpasswd.rb#130
818
+ def set_passwd(realm, user, pass); end
819
+ end
820
+
821
+ # source://webrick//lib/webrick/httpauth/authenticator.rb#114
822
+ WEBrick::HTTPAuth::ProxyAuthenticator::AuthException = WEBrick::HTTPStatus::ProxyAuthenticationRequired
823
+
824
+ # Basic authentication for proxy servers. See BasicAuth for details.
825
+ #
826
+ # source://webrick//lib/webrick/httpauth/basicauth.rb#112
827
+ class WEBrick::HTTPAuth::ProxyBasicAuth < ::WEBrick::HTTPAuth::BasicAuth
828
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
829
+ end
830
+
831
+ # Digest authentication for proxy servers. See DigestAuth for details.
832
+ #
833
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#386
834
+ class WEBrick::HTTPAuth::ProxyDigestAuth < ::WEBrick::HTTPAuth::DigestAuth
835
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
836
+
837
+ private
838
+
839
+ # source://webrick//lib/webrick/httpauth/digestauth.rb#390
840
+ def check_uri(req, auth_req); end
841
+ end
842
+
843
+ # User database mixin for HTTPAuth. This mixin dispatches user record
844
+ # access to the underlying auth_type for this database.
845
+ #
846
+ # source://webrick//lib/webrick/httpauth/userdb.rb#18
847
+ module WEBrick::HTTPAuth::UserDB
848
+ # The authentication type.
849
+ #
850
+ # WEBrick::HTTPAuth::BasicAuth or WEBrick::HTTPAuth::DigestAuth are
851
+ # built-in.
852
+ #
853
+ # source://webrick//lib/webrick/httpauth/userdb.rb#26
854
+ def auth_type; end
855
+
856
+ # The authentication type.
857
+ #
858
+ # WEBrick::HTTPAuth::BasicAuth or WEBrick::HTTPAuth::DigestAuth are
859
+ # built-in.
860
+ #
861
+ # source://webrick//lib/webrick/httpauth/userdb.rb#26
862
+ def auth_type=(_arg0); end
863
+
864
+ # Retrieves a password in +realm+ for +user+ for the auth_type of this
865
+ # database. +reload_db+ is a dummy value.
866
+ #
867
+ # source://webrick//lib/webrick/httpauth/userdb.rb#48
868
+ def get_passwd(realm, user, reload_db = T.unsafe(nil)); end
869
+
870
+ # Creates an obscured password in +realm+ with +user+ and +password+
871
+ # using the auth_type of this database.
872
+ #
873
+ # source://webrick//lib/webrick/httpauth/userdb.rb#32
874
+ def make_passwd(realm, user, pass); end
875
+
876
+ # Sets a password in +realm+ with +user+ and +password+ for the
877
+ # auth_type of this database.
878
+ #
879
+ # source://webrick//lib/webrick/httpauth/userdb.rb#40
880
+ def set_passwd(realm, user, pass); end
881
+ end
882
+
883
+ # --
884
+ # Adds SSL functionality to WEBrick::HTTPRequest
885
+ #
886
+ # source://webrick//lib/webrick/httprequest.rb#25
887
+ class WEBrick::HTTPRequest
888
+ # Creates a new HTTP request. WEBrick::Config::HTTP is the default
889
+ # configuration.
890
+ #
891
+ # @return [HTTPRequest] a new instance of HTTPRequest
892
+ #
893
+ # source://webrick//lib/webrick/httprequest.rb#153
894
+ def initialize(config); end
895
+
896
+ # Retrieves +header_name+
897
+ #
898
+ # source://webrick//lib/webrick/httprequest.rb#318
899
+ def [](header_name); end
900
+
901
+ # The Accept header value
902
+ #
903
+ # source://webrick//lib/webrick/httprequest.rb#100
904
+ def accept; end
905
+
906
+ # The Accept-Charset header value
907
+ #
908
+ # source://webrick//lib/webrick/httprequest.rb#105
909
+ def accept_charset; end
910
+
911
+ # The Accept-Encoding header value
912
+ #
913
+ # source://webrick//lib/webrick/httprequest.rb#110
914
+ def accept_encoding; end
915
+
916
+ # The Accept-Language header value
917
+ #
918
+ # source://webrick//lib/webrick/httprequest.rb#115
919
+ def accept_language; end
920
+
921
+ # The socket address of the server
922
+ #
923
+ # source://webrick//lib/webrick/httprequest.rb#127
924
+ def addr; end
925
+
926
+ # Hash of request attributes
927
+ #
928
+ # source://webrick//lib/webrick/httprequest.rb#137
929
+ def attributes; end
930
+
931
+ # Returns the request body.
932
+ #
933
+ # source://webrick//lib/webrick/httprequest.rb#255
934
+ def body(&block); end
935
+
936
+ # Prepares the HTTPRequest object for use as the
937
+ # source for IO.copy_stream
938
+ #
939
+ # source://webrick//lib/webrick/httprequest.rb#265
940
+ def body_reader; end
941
+
942
+ # The content-length header
943
+ #
944
+ # source://webrick//lib/webrick/httprequest.rb#304
945
+ def content_length; end
946
+
947
+ # The content-type header
948
+ #
949
+ # source://webrick//lib/webrick/httprequest.rb#311
950
+ def content_type; end
951
+
952
+ # Generate HTTP/1.1 100 continue response if the client expects it,
953
+ # otherwise does nothing.
954
+ #
955
+ # source://webrick//lib/webrick/httprequest.rb#245
956
+ def continue; end
957
+
958
+ # The parsed request cookies
959
+ #
960
+ # source://webrick//lib/webrick/httprequest.rb#95
961
+ def cookies; end
962
+
963
+ # Iterates over the request headers
964
+ #
965
+ # source://webrick//lib/webrick/httprequest.rb#328
966
+ def each; end
967
+
968
+ # Consumes any remaining body and updates keep-alive status
969
+ #
970
+ # source://webrick//lib/webrick/httprequest.rb#390
971
+ def fixup; end
972
+
973
+ # The parsed header of the request
974
+ #
975
+ # source://webrick//lib/webrick/httprequest.rb#90
976
+ def header; end
977
+
978
+ # The host this request is for
979
+ #
980
+ # source://webrick//lib/webrick/httprequest.rb#340
981
+ def host; end
982
+
983
+ # The HTTP version of the request
984
+ #
985
+ # source://webrick//lib/webrick/httprequest.rb#51
986
+ def http_version; end
987
+
988
+ # Is this a keep-alive connection?
989
+ #
990
+ # source://webrick//lib/webrick/httprequest.rb#142
991
+ def keep_alive; end
992
+
993
+ # Should the connection this request was made on be kept alive?
994
+ #
995
+ # @return [Boolean]
996
+ #
997
+ # source://webrick//lib/webrick/httprequest.rb#375
998
+ def keep_alive?; end
999
+
1000
+ # This method provides the metavariables defined by the revision 3
1001
+ # of "The WWW Common Gateway Interface Version 1.1"
1002
+ # To browse the current document of CGI Version 1.1, see below:
1003
+ # http://tools.ietf.org/html/rfc3875
1004
+ #
1005
+ # source://webrick//lib/webrick/httprequest.rb#407
1006
+ def meta_vars; end
1007
+
1008
+ # Parses a request from +socket+. This is called internally by
1009
+ # WEBrick::HTTPServer.
1010
+ #
1011
+ # source://webrick//lib/webrick/httprequest.rb#193
1012
+ def parse(socket = T.unsafe(nil)); end
1013
+
1014
+ # The request path
1015
+ #
1016
+ # source://webrick//lib/webrick/httprequest.rb#63
1017
+ def path; end
1018
+
1019
+ # The path info (CGI variable)
1020
+ #
1021
+ # source://webrick//lib/webrick/httprequest.rb#73
1022
+ def path_info; end
1023
+
1024
+ # The path info (CGI variable)
1025
+ #
1026
+ # source://webrick//lib/webrick/httprequest.rb#73
1027
+ def path_info=(_arg0); end
1028
+
1029
+ # The socket address of the client
1030
+ #
1031
+ # source://webrick//lib/webrick/httprequest.rb#132
1032
+ def peeraddr; end
1033
+
1034
+ # The port this request is for
1035
+ #
1036
+ # source://webrick//lib/webrick/httprequest.rb#347
1037
+ def port; end
1038
+
1039
+ # Request query as a Hash
1040
+ #
1041
+ # source://webrick//lib/webrick/httprequest.rb#294
1042
+ def query; end
1043
+
1044
+ # The query from the URI of the request
1045
+ #
1046
+ # source://webrick//lib/webrick/httprequest.rb#78
1047
+ def query_string; end
1048
+
1049
+ # The query from the URI of the request
1050
+ #
1051
+ # source://webrick//lib/webrick/httprequest.rb#78
1052
+ def query_string=(_arg0); end
1053
+
1054
+ # The raw header of the request
1055
+ #
1056
+ # source://webrick//lib/webrick/httprequest.rb#85
1057
+ def raw_header; end
1058
+
1059
+ # for IO.copy_stream.
1060
+ #
1061
+ # source://webrick//lib/webrick/httprequest.rb#278
1062
+ def readpartial(size, buf = T.unsafe(nil)); end
1063
+
1064
+ # The client's IP address
1065
+ #
1066
+ # source://webrick//lib/webrick/httprequest.rb#361
1067
+ def remote_ip; end
1068
+
1069
+ # The complete request line such as:
1070
+ #
1071
+ # GET / HTTP/1.1
1072
+ #
1073
+ # source://webrick//lib/webrick/httprequest.rb#36
1074
+ def request_line; end
1075
+
1076
+ # The request method, GET, POST, PUT, etc.
1077
+ #
1078
+ # source://webrick//lib/webrick/httprequest.rb#41
1079
+ def request_method; end
1080
+
1081
+ # The local time this request was received
1082
+ #
1083
+ # source://webrick//lib/webrick/httprequest.rb#147
1084
+ def request_time; end
1085
+
1086
+ # The parsed URI of the request
1087
+ #
1088
+ # source://webrick//lib/webrick/httprequest.rb#58
1089
+ def request_uri; end
1090
+
1091
+ # The script name (CGI variable)
1092
+ #
1093
+ # source://webrick//lib/webrick/httprequest.rb#68
1094
+ def script_name; end
1095
+
1096
+ # The script name (CGI variable)
1097
+ #
1098
+ # source://webrick//lib/webrick/httprequest.rb#68
1099
+ def script_name=(_arg0); end
1100
+
1101
+ # The server name this request is for
1102
+ #
1103
+ # source://webrick//lib/webrick/httprequest.rb#354
1104
+ def server_name; end
1105
+
1106
+ # Is this an SSL request?
1107
+ #
1108
+ # @return [Boolean]
1109
+ #
1110
+ # source://webrick//lib/webrick/httprequest.rb#368
1111
+ def ssl?; end
1112
+
1113
+ # source://webrick//lib/webrick/httprequest.rb#379
1114
+ def to_s; end
1115
+
1116
+ # The unparsed URI of the request
1117
+ #
1118
+ # source://webrick//lib/webrick/httprequest.rb#46
1119
+ def unparsed_uri; end
1120
+
1121
+ # The remote user (CGI variable)
1122
+ #
1123
+ # source://webrick//lib/webrick/httprequest.rb#122
1124
+ def user; end
1125
+
1126
+ # The remote user (CGI variable)
1127
+ #
1128
+ # source://webrick//lib/webrick/httprequest.rb#122
1129
+ def user=(_arg0); end
1130
+
1131
+ private
1132
+
1133
+ # source://webrick//lib/webrick/httprequest.rb#562
1134
+ def _read_data(io, method, *arg); end
1135
+
1136
+ # source://webrick//lib/webrick/httprequest.rb#582
1137
+ def parse_query; end
1138
+
1139
+ # source://webrick//lib/webrick/httprequest.rb#484
1140
+ def parse_uri(str, scheme = T.unsafe(nil)); end
1141
+
1142
+ # source://webrick//lib/webrick/httprequest.rb#507
1143
+ def read_body(socket, block); end
1144
+
1145
+ # source://webrick//lib/webrick/httprequest.rb#531
1146
+ def read_chunk_size(socket); end
1147
+
1148
+ # source://webrick//lib/webrick/httprequest.rb#542
1149
+ def read_chunked(socket, block); end
1150
+
1151
+ # source://webrick//lib/webrick/httprequest.rb#578
1152
+ def read_data(io, size); end
1153
+
1154
+ # source://webrick//lib/webrick/httprequest.rb#471
1155
+ def read_header(socket); end
1156
+
1157
+ # source://webrick//lib/webrick/httprequest.rb#574
1158
+ def read_line(io, size = T.unsafe(nil)); end
1159
+
1160
+ # @raise [HTTPStatus::EOFError]
1161
+ #
1162
+ # source://webrick//lib/webrick/httprequest.rb#451
1163
+ def read_request_line(socket); end
1164
+
1165
+ # It's said that all X-Forwarded-* headers will contain more than one
1166
+ # (comma-separated) value if the original request already contained one of
1167
+ # these headers. Since we could use these values as Host header, we choose
1168
+ # the initial(first) value. (apr_table_mergen() adds new value after the
1169
+ # existing value with ", " prefix)
1170
+ #
1171
+ # source://webrick//lib/webrick/httprequest.rb#610
1172
+ def setup_forwarded_info; end
1173
+ end
1174
+
1175
+ # same as Mongrel, Thin and Puma
1176
+ #
1177
+ # source://webrick//lib/webrick/httprequest.rb#449
1178
+ WEBrick::HTTPRequest::MAX_HEADER_LENGTH = T.let(T.unsafe(nil), Integer)
1179
+
1180
+ # An HTTP response. This is filled in by the service or do_* methods of a
1181
+ # WEBrick HTTP Servlet.
1182
+ #
1183
+ # source://webrick//lib/webrick/httpresponse.rb#24
1184
+ class WEBrick::HTTPResponse
1185
+ # Creates a new HTTP response object. WEBrick::Config::HTTP is the
1186
+ # default configuration.
1187
+ #
1188
+ # @return [HTTPResponse] a new instance of HTTPResponse
1189
+ #
1190
+ # source://webrick//lib/webrick/httpresponse.rb#112
1191
+ def initialize(config); end
1192
+
1193
+ # Retrieves the response header +field+
1194
+ #
1195
+ # source://webrick//lib/webrick/httpresponse.rb#150
1196
+ def [](field); end
1197
+
1198
+ # Sets the response header +field+ to +value+
1199
+ #
1200
+ # source://webrick//lib/webrick/httpresponse.rb#157
1201
+ def []=(field, value); end
1202
+
1203
+ # source://webrick//lib/webrick/httpresponse.rb#240
1204
+ def _rack_setup_header; end
1205
+
1206
+ # Body may be:
1207
+ # * a String;
1208
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
1209
+ # * a Proc-like object that responds to +#call+.
1210
+ #
1211
+ # In the latter case, either #chunked= should be set to +true+,
1212
+ # or <code>header['content-length']</code> explicitly provided.
1213
+ # Example:
1214
+ #
1215
+ # server.mount_proc '/' do |req, res|
1216
+ # res.chunked = true
1217
+ # # or
1218
+ # # res.header['content-length'] = 10
1219
+ # res.body = proc { |out| out.write(Time.now.to_s) }
1220
+ # end
1221
+ #
1222
+ # source://webrick//lib/webrick/httpresponse.rb#70
1223
+ def body; end
1224
+
1225
+ # Body may be:
1226
+ # * a String;
1227
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
1228
+ # * a Proc-like object that responds to +#call+.
1229
+ #
1230
+ # In the latter case, either #chunked= should be set to +true+,
1231
+ # or <code>header['content-length']</code> explicitly provided.
1232
+ # Example:
1233
+ #
1234
+ # server.mount_proc '/' do |req, res|
1235
+ # res.chunked = true
1236
+ # # or
1237
+ # # res.header['content-length'] = 10
1238
+ # res.body = proc { |out| out.write(Time.now.to_s) }
1239
+ # end
1240
+ #
1241
+ # source://webrick//lib/webrick/httpresponse.rb#70
1242
+ def body=(_arg0); end
1243
+
1244
+ # Enables chunked transfer encoding.
1245
+ #
1246
+ # source://webrick//lib/webrick/httpresponse.rb#209
1247
+ def chunked=(val); end
1248
+
1249
+ # Will this response body be returned using chunked transfer-encoding?
1250
+ #
1251
+ # @return [Boolean]
1252
+ #
1253
+ # source://webrick//lib/webrick/httpresponse.rb#202
1254
+ def chunked?; end
1255
+
1256
+ # Configuration for this response
1257
+ #
1258
+ # source://webrick//lib/webrick/httpresponse.rb#101
1259
+ def config; end
1260
+
1261
+ # The content-length header
1262
+ #
1263
+ # source://webrick//lib/webrick/httpresponse.rb#165
1264
+ def content_length; end
1265
+
1266
+ # Sets the content-length header to +len+
1267
+ #
1268
+ # source://webrick//lib/webrick/httpresponse.rb#174
1269
+ def content_length=(len); end
1270
+
1271
+ # The content-type header
1272
+ #
1273
+ # source://webrick//lib/webrick/httpresponse.rb#181
1274
+ def content_type; end
1275
+
1276
+ # Sets the content-type header to +type+
1277
+ #
1278
+ # source://webrick//lib/webrick/httpresponse.rb#188
1279
+ def content_type=(type); end
1280
+
1281
+ # Response cookies
1282
+ #
1283
+ # source://webrick//lib/webrick/httpresponse.rb#46
1284
+ def cookies; end
1285
+
1286
+ # Iterates over each header in the response
1287
+ #
1288
+ # source://webrick//lib/webrick/httpresponse.rb#195
1289
+ def each; end
1290
+
1291
+ # Filename of the static file in this response. Only used by the
1292
+ # FileHandler servlet.
1293
+ #
1294
+ # source://webrick//lib/webrick/httpresponse.rb#91
1295
+ def filename; end
1296
+
1297
+ # Filename of the static file in this response. Only used by the
1298
+ # FileHandler servlet.
1299
+ #
1300
+ # source://webrick//lib/webrick/httpresponse.rb#91
1301
+ def filename=(_arg0); end
1302
+
1303
+ # Response header
1304
+ #
1305
+ # source://webrick//lib/webrick/httpresponse.rb#41
1306
+ def header; end
1307
+
1308
+ # HTTP Response version
1309
+ #
1310
+ # source://webrick//lib/webrick/httpresponse.rb#31
1311
+ def http_version; end
1312
+
1313
+ # Is this a keep-alive response?
1314
+ #
1315
+ # source://webrick//lib/webrick/httpresponse.rb#96
1316
+ def keep_alive; end
1317
+
1318
+ # Is this a keep-alive response?
1319
+ #
1320
+ # source://webrick//lib/webrick/httpresponse.rb#96
1321
+ def keep_alive=(_arg0); end
1322
+
1323
+ # Will this response's connection be kept alive?
1324
+ #
1325
+ # @return [Boolean]
1326
+ #
1327
+ # source://webrick//lib/webrick/httpresponse.rb#216
1328
+ def keep_alive?; end
1329
+
1330
+ # source://webrick//lib/webrick/httpresponse.rb#303
1331
+ def make_body_tempfile; end
1332
+
1333
+ # Response reason phrase ("OK")
1334
+ #
1335
+ # source://webrick//lib/webrick/httpresponse.rb#51
1336
+ def reason_phrase; end
1337
+
1338
+ # Response reason phrase ("OK")
1339
+ #
1340
+ # source://webrick//lib/webrick/httpresponse.rb#51
1341
+ def reason_phrase=(_arg0); end
1342
+
1343
+ # source://webrick//lib/webrick/httpresponse.rb#321
1344
+ def remove_body_tempfile; end
1345
+
1346
+ # Request HTTP version for this response
1347
+ #
1348
+ # source://webrick//lib/webrick/httpresponse.rb#85
1349
+ def request_http_version; end
1350
+
1351
+ # Request HTTP version for this response
1352
+ #
1353
+ # source://webrick//lib/webrick/httpresponse.rb#85
1354
+ def request_http_version=(_arg0); end
1355
+
1356
+ # Request method for this response
1357
+ #
1358
+ # source://webrick//lib/webrick/httpresponse.rb#75
1359
+ def request_method; end
1360
+
1361
+ # Request method for this response
1362
+ #
1363
+ # source://webrick//lib/webrick/httpresponse.rb#75
1364
+ def request_method=(_arg0); end
1365
+
1366
+ # Request URI for this response
1367
+ #
1368
+ # source://webrick//lib/webrick/httpresponse.rb#80
1369
+ def request_uri; end
1370
+
1371
+ # Request URI for this response
1372
+ #
1373
+ # source://webrick//lib/webrick/httpresponse.rb#80
1374
+ def request_uri=(_arg0); end
1375
+
1376
+ # Sends the body on +socket+
1377
+ #
1378
+ # source://webrick//lib/webrick/httpresponse.rb#356
1379
+ def send_body(socket); end
1380
+
1381
+ # Sends the headers on +socket+
1382
+ #
1383
+ # source://webrick//lib/webrick/httpresponse.rb#333
1384
+ def send_header(socket); end
1385
+
1386
+ # Sends the response on +socket+
1387
+ #
1388
+ # source://webrick//lib/webrick/httpresponse.rb#223
1389
+ def send_response(socket); end
1390
+
1391
+ # Bytes sent in this response
1392
+ #
1393
+ # source://webrick//lib/webrick/httpresponse.rb#106
1394
+ def sent_size; end
1395
+
1396
+ # Creates an error page for exception +ex+ with an optional +backtrace+
1397
+ #
1398
+ # source://webrick//lib/webrick/httpresponse.rb#383
1399
+ def set_error(ex, backtrace = T.unsafe(nil)); end
1400
+
1401
+ # Redirects to +url+ with a WEBrick::HTTPStatus::Redirect +status+.
1402
+ #
1403
+ # Example:
1404
+ #
1405
+ # res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
1406
+ #
1407
+ # source://webrick//lib/webrick/httpresponse.rb#373
1408
+ def set_redirect(status, url); end
1409
+
1410
+ # Response status code (200)
1411
+ #
1412
+ # source://webrick//lib/webrick/httpresponse.rb#36
1413
+ def status; end
1414
+
1415
+ # Sets the response's status to the +status+ code
1416
+ #
1417
+ # source://webrick//lib/webrick/httpresponse.rb#142
1418
+ def status=(status); end
1419
+
1420
+ # The response's HTTP status line
1421
+ #
1422
+ # source://webrick//lib/webrick/httpresponse.rb#135
1423
+ def status_line; end
1424
+
1425
+ private
1426
+
1427
+ # preserved for compatibility with some 3rd-party handlers
1428
+ #
1429
+ # source://webrick//lib/webrick/httpresponse.rb#557
1430
+ def _write_data(socket, data); end
1431
+
1432
+ # source://webrick//lib/webrick/httpresponse.rb#410
1433
+ def check_header(header_value); end
1434
+
1435
+ # :stopdoc:
1436
+ #
1437
+ # source://webrick//lib/webrick/httpresponse.rb#421
1438
+ def error_body(backtrace, ex, host, port); end
1439
+
1440
+ # source://webrick//lib/webrick/httpresponse.rb#451
1441
+ def send_body_io(socket); end
1442
+
1443
+ # source://webrick//lib/webrick/httpresponse.rb#513
1444
+ def send_body_proc(socket); end
1445
+
1446
+ # source://webrick//lib/webrick/httpresponse.rb#491
1447
+ def send_body_string(socket); end
1448
+ end
1449
+
1450
+ # source://webrick//lib/webrick/httpresponse.rb#531
1451
+ class WEBrick::HTTPResponse::ChunkedWrapper
1452
+ # @return [ChunkedWrapper] a new instance of ChunkedWrapper
1453
+ #
1454
+ # source://webrick//lib/webrick/httpresponse.rb#532
1455
+ def initialize(socket, resp); end
1456
+
1457
+ # source://webrick//lib/webrick/httpresponse.rb#550
1458
+ def <<(*buf); end
1459
+
1460
+ # source://webrick//lib/webrick/httpresponse.rb#537
1461
+ def write(buf); end
1462
+ end
1463
+
1464
+ # An HTTP Server
1465
+ #
1466
+ # source://webrick//lib/webrick/httpserver.rb#44
1467
+ class WEBrick::HTTPServer < ::WEBrick::GenericServer
1468
+ # Creates a new HTTP server according to +config+
1469
+ #
1470
+ # An HTTP server uses the following attributes:
1471
+ #
1472
+ # :AccessLog:: An array of access logs. See WEBrick::AccessLog
1473
+ # :BindAddress:: Local address for the server to bind to
1474
+ # :DocumentRoot:: Root path to serve files from
1475
+ # :DocumentRootOptions:: Options for the default HTTPServlet::FileHandler
1476
+ # :HTTPVersion:: The HTTP version of this server
1477
+ # :Port:: Port to listen on
1478
+ # :RequestCallback:: Called with a request and response before each
1479
+ # request is serviced.
1480
+ # :RequestTimeout:: Maximum time to wait between requests
1481
+ # :ServerAlias:: Array of alternate names for this server for virtual
1482
+ # hosting
1483
+ # :ServerName:: Name for this server for virtual hosting
1484
+ #
1485
+ # @return [HTTPServer] a new instance of HTTPServer
1486
+ #
1487
+ # source://webrick//lib/webrick/httpserver.rb#46
1488
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
1489
+
1490
+ # Logs +req+ and +res+ in the access logs. +config+ is used for the
1491
+ # server name.
1492
+ #
1493
+ # source://webrick//lib/webrick/httpserver.rb#220
1494
+ def access_log(config, req, res); end
1495
+
1496
+ # Creates the HTTPRequest used when handling the HTTP
1497
+ # request. Can be overridden by subclasses.
1498
+ #
1499
+ # source://webrick//lib/webrick/httpserver.rb#230
1500
+ def create_request(with_webrick_config); end
1501
+
1502
+ # Creates the HTTPResponse used when handling the HTTP
1503
+ # request. Can be overridden by subclasses.
1504
+ #
1505
+ # source://webrick//lib/webrick/httpserver.rb#237
1506
+ def create_response(with_webrick_config); end
1507
+
1508
+ # The default OPTIONS request handler says GET, HEAD, POST and OPTIONS
1509
+ # requests are allowed.
1510
+ #
1511
+ # source://webrick//lib/webrick/httpserver.rb#147
1512
+ def do_OPTIONS(req, res); end
1513
+
1514
+ # Finds the appropriate virtual host to handle +req+
1515
+ #
1516
+ # source://webrick//lib/webrick/httpserver.rb#207
1517
+ def lookup_server(req); end
1518
+
1519
+ # Mounts +servlet+ on +dir+ passing +options+ to the servlet at creation
1520
+ # time
1521
+ #
1522
+ # source://webrick//lib/webrick/httpserver.rb#155
1523
+ def mount(dir, servlet, *options); end
1524
+
1525
+ # Mounts +proc+ or +block+ on +dir+ and calls it with a
1526
+ # WEBrick::HTTPRequest and WEBrick::HTTPResponse
1527
+ #
1528
+ # @raise [HTTPServerError]
1529
+ #
1530
+ # source://webrick//lib/webrick/httpserver.rb#164
1531
+ def mount_proc(dir, proc = T.unsafe(nil), &block); end
1532
+
1533
+ # Processes requests on +sock+
1534
+ #
1535
+ # source://webrick//lib/webrick/httpserver.rb#69
1536
+ def run(sock); end
1537
+
1538
+ # Finds a servlet for +path+
1539
+ #
1540
+ # source://webrick//lib/webrick/httpserver.rb#182
1541
+ def search_servlet(path); end
1542
+
1543
+ # Services +req+ and fills in +res+
1544
+ #
1545
+ # @raise [HTTPStatus::NotFound]
1546
+ #
1547
+ # source://webrick//lib/webrick/httpserver.rb#125
1548
+ def service(req, res); end
1549
+
1550
+ # Unmounts +dir+
1551
+ #
1552
+ # source://webrick//lib/webrick/httpserver.rb#173
1553
+ def umount(dir); end
1554
+
1555
+ # Unmounts +dir+
1556
+ #
1557
+ # source://webrick//lib/webrick/httpserver.rb#173
1558
+ def unmount(dir); end
1559
+
1560
+ # Adds +server+ as a virtual host.
1561
+ #
1562
+ # source://webrick//lib/webrick/httpserver.rb#193
1563
+ def virtual_host(server); end
1564
+ end
1565
+
1566
+ # Mount table for the path a servlet is mounted on in the directory space
1567
+ # of the server. Users of WEBrick can only access this indirectly via
1568
+ # WEBrick::HTTPServer#mount, WEBrick::HTTPServer#unmount and
1569
+ # WEBrick::HTTPServer#search_servlet
1570
+ #
1571
+ # source://webrick//lib/webrick/httpserver.rb#247
1572
+ class WEBrick::HTTPServer::MountTable
1573
+ # @return [MountTable] a new instance of MountTable
1574
+ #
1575
+ # source://webrick//lib/webrick/httpserver.rb#248
1576
+ def initialize; end
1577
+
1578
+ # source://webrick//lib/webrick/httpserver.rb#253
1579
+ def [](dir); end
1580
+
1581
+ # source://webrick//lib/webrick/httpserver.rb#258
1582
+ def []=(dir, val); end
1583
+
1584
+ # source://webrick//lib/webrick/httpserver.rb#265
1585
+ def delete(dir); end
1586
+
1587
+ # source://webrick//lib/webrick/httpserver.rb#272
1588
+ def scan(path); end
1589
+
1590
+ private
1591
+
1592
+ # source://webrick//lib/webrick/httpserver.rb#279
1593
+ def compile; end
1594
+
1595
+ # source://webrick//lib/webrick/httpserver.rb#287
1596
+ def normalize(dir); end
1597
+ end
1598
+
1599
+ # AbstractServlet allows HTTP server modules to be reused across multiple
1600
+ # servers and allows encapsulation of functionality.
1601
+ #
1602
+ # By default a servlet will respond to GET, HEAD (through an alias to GET)
1603
+ # and OPTIONS requests.
1604
+ #
1605
+ # By default a new servlet is initialized for every request. A servlet
1606
+ # instance can be reused by overriding ::get_instance in the
1607
+ # AbstractServlet subclass.
1608
+ #
1609
+ # == A Simple Servlet
1610
+ #
1611
+ # class Simple < WEBrick::HTTPServlet::AbstractServlet
1612
+ # def do_GET request, response
1613
+ # status, content_type, body = do_stuff_with request
1614
+ #
1615
+ # response.status = status
1616
+ # response['Content-Type'] = content_type
1617
+ # response.body = body
1618
+ # end
1619
+ #
1620
+ # def do_stuff_with request
1621
+ # return 200, 'text/plain', 'you got a page'
1622
+ # end
1623
+ # end
1624
+ #
1625
+ # This servlet can be mounted on a server at a given path:
1626
+ #
1627
+ # server.mount '/simple', Simple
1628
+ #
1629
+ # == Servlet Configuration
1630
+ #
1631
+ # Servlets can be configured via initialize. The first argument is the
1632
+ # HTTP server the servlet is being initialized for.
1633
+ #
1634
+ # class Configurable < Simple
1635
+ # def initialize server, color, size
1636
+ # super server
1637
+ # @color = color
1638
+ # @size = size
1639
+ # end
1640
+ #
1641
+ # def do_stuff_with request
1642
+ # content = "<p " \
1643
+ # %q{style="color: #{@color}; font-size: #{@size}"} \
1644
+ # ">Hello, World!"
1645
+ #
1646
+ # return 200, "text/html", content
1647
+ # end
1648
+ # end
1649
+ #
1650
+ # This servlet must be provided two arguments at mount time:
1651
+ #
1652
+ # server.mount '/configurable', Configurable, 'red', '2em'
1653
+ #
1654
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#76
1655
+ class WEBrick::HTTPServlet::AbstractServlet
1656
+ # Initializes a new servlet for +server+ using +options+ which are
1657
+ # stored as-is in +@options+. +@logger+ is also provided.
1658
+ #
1659
+ # @return [AbstractServlet] a new instance of AbstractServlet
1660
+ #
1661
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#91
1662
+ def initialize(server, *options); end
1663
+
1664
+ # Raises a NotFound exception
1665
+ #
1666
+ # @raise [HTTPStatus::NotFound]
1667
+ #
1668
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#115
1669
+ def do_GET(req, res); end
1670
+
1671
+ # Dispatches to do_GET
1672
+ #
1673
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#122
1674
+ def do_HEAD(req, res); end
1675
+
1676
+ # Returns the allowed HTTP request methods
1677
+ #
1678
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#129
1679
+ def do_OPTIONS(req, res); end
1680
+
1681
+ # Dispatches to a +do_+ method based on +req+ if such a method is
1682
+ # available. (+do_GET+ for a GET request). Raises a MethodNotAllowed
1683
+ # exception if the method is not implemented.
1684
+ #
1685
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#102
1686
+ def service(req, res); end
1687
+
1688
+ private
1689
+
1690
+ # Redirects to a path ending in /
1691
+ #
1692
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#140
1693
+ def redirect_to_directory_uri(req, res); end
1694
+
1695
+ class << self
1696
+ # Factory for servlet instances that will handle a request from +server+
1697
+ # using +options+ from the mount point. By default a new servlet
1698
+ # instance is created for every call.
1699
+ #
1700
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#83
1701
+ def get_instance(server, *options); end
1702
+ end
1703
+ end
1704
+
1705
+ # Servlet for handling CGI scripts
1706
+ #
1707
+ # Example:
1708
+ #
1709
+ # server.mount('/cgi/my_script', WEBrick::HTTPServlet::CGIHandler,
1710
+ # '/path/to/my_script')
1711
+ #
1712
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#28
1713
+ class WEBrick::HTTPServlet::CGIHandler < ::WEBrick::HTTPServlet::AbstractServlet
1714
+ # Creates a new CGI script servlet for the script at +name+
1715
+ #
1716
+ # @return [CGIHandler] a new instance of CGIHandler
1717
+ #
1718
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#36
1719
+ def initialize(server, name); end
1720
+
1721
+ # :stopdoc:
1722
+ #
1723
+ # @raise [HTTPStatus::InternalServerError]
1724
+ #
1725
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#50
1726
+ def do_GET(req, res); end
1727
+
1728
+ # :stopdoc:
1729
+ #
1730
+ # @raise [HTTPStatus::InternalServerError]
1731
+ #
1732
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#50
1733
+ def do_POST(req, res); end
1734
+ end
1735
+
1736
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#31
1737
+ WEBrick::HTTPServlet::CGIHandler::CGIRunnerArray = T.let(T.unsafe(nil), Array)
1738
+
1739
+ # Servlet for serving a single file. You probably want to use the
1740
+ # FileHandler servlet instead as it handles directories and fancy indexes.
1741
+ #
1742
+ # Example:
1743
+ #
1744
+ # server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,
1745
+ # '/path/to/my_page.txt')
1746
+ #
1747
+ # This servlet handles If-Modified-Since and Range requests.
1748
+ #
1749
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#32
1750
+ class WEBrick::HTTPServlet::DefaultFileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1751
+ # Creates a DefaultFileHandler instance for the file at +local_path+.
1752
+ #
1753
+ # @return [DefaultFileHandler] a new instance of DefaultFileHandler
1754
+ #
1755
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#37
1756
+ def initialize(server, local_path); end
1757
+
1758
+ # :stopdoc:
1759
+ #
1760
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#44
1761
+ def do_GET(req, res); end
1762
+
1763
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#118
1764
+ def make_partial_content(req, res, filename, filesize); end
1765
+
1766
+ # returns a lambda for webrick/httpresponse.rb send_body_proc
1767
+ #
1768
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#90
1769
+ def multipart_body(body, parts, boundary, mtype, filesize); end
1770
+
1771
+ # @return [Boolean]
1772
+ #
1773
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#64
1774
+ def not_modified?(req, res, mtime, etag); end
1775
+
1776
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#155
1777
+ def prepare_range(range, filesize); end
1778
+ end
1779
+
1780
+ # ERBHandler evaluates an ERB file and returns the result. This handler
1781
+ # is automatically used if there are .rhtml files in a directory served by
1782
+ # the FileHandler.
1783
+ #
1784
+ # ERBHandler supports GET and POST methods.
1785
+ #
1786
+ # The ERB file is evaluated with the local variables +servlet_request+ and
1787
+ # +servlet_response+ which are a WEBrick::HTTPRequest and
1788
+ # WEBrick::HTTPResponse respectively.
1789
+ #
1790
+ # Example .rhtml file:
1791
+ #
1792
+ # Request to <%= servlet_request.request_uri %>
1793
+ #
1794
+ # Query params <%= servlet_request.query.inspect %>
1795
+ #
1796
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#36
1797
+ class WEBrick::HTTPServlet::ERBHandler < ::WEBrick::HTTPServlet::AbstractServlet
1798
+ # Creates a new ERBHandler on +server+ that will evaluate and serve the
1799
+ # ERB file +name+
1800
+ #
1801
+ # @return [ERBHandler] a new instance of ERBHandler
1802
+ #
1803
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#42
1804
+ def initialize(server, name); end
1805
+
1806
+ # Handles GET requests
1807
+ #
1808
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#50
1809
+ def do_GET(req, res); end
1810
+
1811
+ # Handles GET requests
1812
+ #
1813
+ # Handles POST requests
1814
+ #
1815
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#50
1816
+ def do_POST(req, res); end
1817
+
1818
+ private
1819
+
1820
+ # Evaluates +erb+ providing +servlet_request+ and +servlet_response+ as
1821
+ # local variables.
1822
+ #
1823
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#79
1824
+ def evaluate(erb, servlet_request, servlet_response); end
1825
+ end
1826
+
1827
+ # Serves a directory including fancy indexing and a variety of other
1828
+ # options.
1829
+ #
1830
+ # Example:
1831
+ #
1832
+ # server.mount('/assets', WEBrick::HTTPServlet::FileHandler,
1833
+ # '/path/to/assets')
1834
+ #
1835
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#175
1836
+ class WEBrick::HTTPServlet::FileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1837
+ # Creates a FileHandler servlet on +server+ that serves files starting
1838
+ # at directory +root+
1839
+ #
1840
+ # +options+ may be a Hash containing keys from
1841
+ # WEBrick::Config::FileHandler or +true+ or +false+.
1842
+ #
1843
+ # If +options+ is true or false then +:FancyIndexing+ is enabled or
1844
+ # disabled respectively.
1845
+ #
1846
+ # @return [FileHandler] a new instance of FileHandler
1847
+ #
1848
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#203
1849
+ def initialize(server, root, options = T.unsafe(nil), default = T.unsafe(nil)); end
1850
+
1851
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#245
1852
+ def do_GET(req, res); end
1853
+
1854
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#257
1855
+ def do_OPTIONS(req, res); end
1856
+
1857
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#251
1858
+ def do_POST(req, res); end
1859
+
1860
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#224
1861
+ def service(req, res); end
1862
+
1863
+ # :stopdoc:
1864
+ #
1865
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#215
1866
+ def set_filesystem_encoding(str); end
1867
+
1868
+ private
1869
+
1870
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#416
1871
+ def call_callback(callback_name, req, res); end
1872
+
1873
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#369
1874
+ def check_filename(req, res, name); end
1875
+
1876
+ # @raise [HTTPStatus::NotFound]
1877
+ #
1878
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#309
1879
+ def exec_handler(req, res); end
1880
+
1881
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#322
1882
+ def get_handler(req, res); end
1883
+
1884
+ # @return [Boolean]
1885
+ #
1886
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#428
1887
+ def nondisclosure_name?(name); end
1888
+
1889
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#286
1890
+ def prevent_directory_traversal(req, res); end
1891
+
1892
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#394
1893
+ def search_file(req, res, basename); end
1894
+
1895
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#385
1896
+ def search_index_file(req, res); end
1897
+
1898
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#437
1899
+ def set_dir_list(req, res); end
1900
+
1901
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#335
1902
+ def set_filename(req, res); end
1903
+
1904
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#376
1905
+ def shift_path_info(req, res, path_info, base = T.unsafe(nil)); end
1906
+
1907
+ # @return [Boolean]
1908
+ #
1909
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#277
1910
+ def trailing_pathsep?(path); end
1911
+
1912
+ # @return [Boolean]
1913
+ #
1914
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#422
1915
+ def windows_ambiguous_name?(name); end
1916
+
1917
+ class << self
1918
+ # Allow custom handling of requests for files with +suffix+ by class
1919
+ # +handler+
1920
+ #
1921
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#182
1922
+ def add_handler(suffix, handler); end
1923
+
1924
+ # Remove custom handling of requests for files with +suffix+
1925
+ #
1926
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#189
1927
+ def remove_handler(suffix); end
1928
+ end
1929
+ end
1930
+
1931
+ # This module is used to manager HTTP status codes.
1932
+ #
1933
+ # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more
1934
+ # information.
1935
+ #
1936
+ # source://webrick//lib/webrick/httpstatus.rb#21
1937
+ module WEBrick::HTTPStatus
1938
+ private
1939
+
1940
+ # Is +code+ a client error status?
1941
+ #
1942
+ # @return [Boolean]
1943
+ #
1944
+ # source://webrick//lib/webrick/httpstatus.rb#170
1945
+ def client_error?(code); end
1946
+
1947
+ # Is +code+ an error status?
1948
+ #
1949
+ # @return [Boolean]
1950
+ #
1951
+ # source://webrick//lib/webrick/httpstatus.rb#164
1952
+ def error?(code); end
1953
+
1954
+ # Is +code+ an informational status?
1955
+ #
1956
+ # @return [Boolean]
1957
+ #
1958
+ # source://webrick//lib/webrick/httpstatus.rb#146
1959
+ def info?(code); end
1960
+
1961
+ # Returns the description corresponding to the HTTP status +code+
1962
+ #
1963
+ # WEBrick::HTTPStatus.reason_phrase 404
1964
+ # => "Not Found"
1965
+ #
1966
+ # source://webrick//lib/webrick/httpstatus.rb#140
1967
+ def reason_phrase(code); end
1968
+
1969
+ # Is +code+ a redirection status?
1970
+ #
1971
+ # @return [Boolean]
1972
+ #
1973
+ # source://webrick//lib/webrick/httpstatus.rb#158
1974
+ def redirect?(code); end
1975
+
1976
+ # Is +code+ a server error status?
1977
+ #
1978
+ # @return [Boolean]
1979
+ #
1980
+ # source://webrick//lib/webrick/httpstatus.rb#176
1981
+ def server_error?(code); end
1982
+
1983
+ # Is +code+ a successful status?
1984
+ #
1985
+ # @return [Boolean]
1986
+ #
1987
+ # source://webrick//lib/webrick/httpstatus.rb#152
1988
+ def success?(code); end
1989
+
1990
+ class << self
1991
+ # Returns the status class corresponding to +code+
1992
+ #
1993
+ # WEBrick::HTTPStatus[302]
1994
+ # => WEBrick::HTTPStatus::NotFound
1995
+ #
1996
+ # source://webrick//lib/webrick/httpstatus.rb#186
1997
+ def [](code); end
1998
+
1999
+ # Is +code+ a client error status?
2000
+ #
2001
+ # @return [Boolean]
2002
+ #
2003
+ # source://webrick//lib/webrick/httpstatus.rb#170
2004
+ def client_error?(code); end
2005
+
2006
+ # Is +code+ an error status?
2007
+ #
2008
+ # @return [Boolean]
2009
+ #
2010
+ # source://webrick//lib/webrick/httpstatus.rb#164
2011
+ def error?(code); end
2012
+
2013
+ # Is +code+ an informational status?
2014
+ #
2015
+ # @return [Boolean]
2016
+ #
2017
+ # source://webrick//lib/webrick/httpstatus.rb#146
2018
+ def info?(code); end
2019
+
2020
+ # Returns the description corresponding to the HTTP status +code+
2021
+ #
2022
+ # WEBrick::HTTPStatus.reason_phrase 404
2023
+ # => "Not Found"
2024
+ #
2025
+ # source://webrick//lib/webrick/httpstatus.rb#140
2026
+ def reason_phrase(code); end
2027
+
2028
+ # Is +code+ a redirection status?
2029
+ #
2030
+ # @return [Boolean]
2031
+ #
2032
+ # source://webrick//lib/webrick/httpstatus.rb#158
2033
+ def redirect?(code); end
2034
+
2035
+ # Is +code+ a server error status?
2036
+ #
2037
+ # @return [Boolean]
2038
+ #
2039
+ # source://webrick//lib/webrick/httpstatus.rb#176
2040
+ def server_error?(code); end
2041
+
2042
+ # Is +code+ a successful status?
2043
+ #
2044
+ # @return [Boolean]
2045
+ #
2046
+ # source://webrick//lib/webrick/httpstatus.rb#152
2047
+ def success?(code); end
2048
+ end
2049
+ end
2050
+
2051
+ # Root of the HTTP status class hierarchy
2052
+ #
2053
+ # source://webrick//lib/webrick/httpstatus.rb#25
2054
+ class WEBrick::HTTPStatus::Status < ::StandardError
2055
+ # Returns the HTTP status code
2056
+ #
2057
+ # source://webrick//lib/webrick/httpstatus.rb#31
2058
+ def code; end
2059
+
2060
+ # Returns the HTTP status description
2061
+ #
2062
+ # source://webrick//lib/webrick/httpstatus.rb#34
2063
+ def reason_phrase; end
2064
+
2065
+ # Returns the HTTP status code
2066
+ #
2067
+ # source://webrick//lib/webrick/httpstatus.rb#31
2068
+ def to_i; end
2069
+
2070
+ class << self
2071
+ # source://webrick//lib/webrick/httpstatus.rb#27
2072
+ def code; end
2073
+
2074
+ # source://webrick//lib/webrick/httpstatus.rb#27
2075
+ def reason_phrase; end
2076
+ end
2077
+ end
2078
+
2079
+ # HTTPUtils provides utility methods for working with the HTTP protocol.
2080
+ #
2081
+ # This module is generally used internally by WEBrick
2082
+ #
2083
+ # source://webrick//lib/webrick/httputils.rb#25
2084
+ module WEBrick::HTTPUtils
2085
+ private
2086
+
2087
+ # source://webrick//lib/webrick/httputils.rb#443
2088
+ def _escape(str, regex); end
2089
+
2090
+ # :stopdoc:
2091
+ #
2092
+ # source://webrick//lib/webrick/httputils.rb#441
2093
+ def _make_regex(str); end
2094
+
2095
+ # source://webrick//lib/webrick/httputils.rb#442
2096
+ def _make_regex!(str); end
2097
+
2098
+ # source://webrick//lib/webrick/httputils.rb#449
2099
+ def _unescape(str, regex); end
2100
+
2101
+ # Removes quotes and escapes from +str+
2102
+ #
2103
+ # source://webrick//lib/webrick/httputils.rb#223
2104
+ def dequote(str); end
2105
+
2106
+ # Escapes HTTP reserved and unwise characters in +str+
2107
+ #
2108
+ # source://webrick//lib/webrick/httputils.rb#467
2109
+ def escape(str); end
2110
+
2111
+ # Escapes 8 bit characters in +str+
2112
+ #
2113
+ # source://webrick//lib/webrick/httputils.rb#508
2114
+ def escape8bit(str); end
2115
+
2116
+ # Escapes form reserved characters in +str+
2117
+ #
2118
+ # source://webrick//lib/webrick/httputils.rb#481
2119
+ def escape_form(str); end
2120
+
2121
+ # Escapes path +str+
2122
+ #
2123
+ # source://webrick//lib/webrick/httputils.rb#497
2124
+ def escape_path(str); end
2125
+
2126
+ # Loads Apache-compatible mime.types in +file+.
2127
+ #
2128
+ # source://webrick//lib/webrick/httputils.rb#112
2129
+ def load_mime_types(file); end
2130
+
2131
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
2132
+ # mime type was found application/octet-stream is returned.
2133
+ #
2134
+ # source://webrick//lib/webrick/httputils.rb#134
2135
+ def mime_type(filename, mime_tab); end
2136
+
2137
+ # Normalizes a request path. Raises an exception if the path cannot be
2138
+ # normalized.
2139
+ #
2140
+ # source://webrick//lib/webrick/httputils.rb#31
2141
+ def normalize_path(path); end
2142
+
2143
+ # Parses form data in +io+ with the given +boundary+
2144
+ #
2145
+ # source://webrick//lib/webrick/httputils.rb#395
2146
+ def parse_form_data(io, boundary); end
2147
+
2148
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
2149
+ # of values.
2150
+ #
2151
+ # source://webrick//lib/webrick/httputils.rb#145
2152
+ def parse_header(raw); end
2153
+
2154
+ # Parses the query component of a URI in +str+
2155
+ #
2156
+ # source://webrick//lib/webrick/httputils.rb#371
2157
+ def parse_query(str); end
2158
+
2159
+ # Parses q values in +value+ as used in Accept headers.
2160
+ #
2161
+ # source://webrick//lib/webrick/httputils.rb#202
2162
+ def parse_qvalues(value); end
2163
+
2164
+ # Parses a Range header value +ranges_specifier+
2165
+ #
2166
+ # source://webrick//lib/webrick/httputils.rb#184
2167
+ def parse_range_header(ranges_specifier); end
2168
+
2169
+ # Quotes and escapes quotes in +str+
2170
+ #
2171
+ # source://webrick//lib/webrick/httputils.rb#233
2172
+ def quote(str); end
2173
+
2174
+ # Splits a header value +str+ according to HTTP specification.
2175
+ #
2176
+ # source://webrick//lib/webrick/httputils.rb#175
2177
+ def split_header_value(str); end
2178
+
2179
+ # Unescapes HTTP reserved and unwise characters in +str+
2180
+ #
2181
+ # source://webrick//lib/webrick/httputils.rb#474
2182
+ def unescape(str); end
2183
+
2184
+ # Unescapes form reserved characters in +str+
2185
+ #
2186
+ # source://webrick//lib/webrick/httputils.rb#490
2187
+ def unescape_form(str); end
2188
+
2189
+ class << self
2190
+ # source://webrick//lib/webrick/httputils.rb#443
2191
+ def _escape(str, regex); end
2192
+
2193
+ # :stopdoc:
2194
+ #
2195
+ # source://webrick//lib/webrick/httputils.rb#441
2196
+ def _make_regex(str); end
2197
+
2198
+ # source://webrick//lib/webrick/httputils.rb#442
2199
+ def _make_regex!(str); end
2200
+
2201
+ # source://webrick//lib/webrick/httputils.rb#449
2202
+ def _unescape(str, regex); end
2203
+
2204
+ # Removes quotes and escapes from +str+
2205
+ #
2206
+ # source://webrick//lib/webrick/httputils.rb#223
2207
+ def dequote(str); end
2208
+
2209
+ # Escapes HTTP reserved and unwise characters in +str+
2210
+ #
2211
+ # source://webrick//lib/webrick/httputils.rb#467
2212
+ def escape(str); end
2213
+
2214
+ # Escapes 8 bit characters in +str+
2215
+ #
2216
+ # source://webrick//lib/webrick/httputils.rb#508
2217
+ def escape8bit(str); end
2218
+
2219
+ # Escapes form reserved characters in +str+
2220
+ #
2221
+ # source://webrick//lib/webrick/httputils.rb#481
2222
+ def escape_form(str); end
2223
+
2224
+ # Escapes path +str+
2225
+ #
2226
+ # source://webrick//lib/webrick/httputils.rb#497
2227
+ def escape_path(str); end
2228
+
2229
+ # Loads Apache-compatible mime.types in +file+.
2230
+ #
2231
+ # source://webrick//lib/webrick/httputils.rb#112
2232
+ def load_mime_types(file); end
2233
+
2234
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
2235
+ # mime type was found application/octet-stream is returned.
2236
+ #
2237
+ # source://webrick//lib/webrick/httputils.rb#134
2238
+ def mime_type(filename, mime_tab); end
2239
+
2240
+ # Normalizes a request path. Raises an exception if the path cannot be
2241
+ # normalized.
2242
+ #
2243
+ # source://webrick//lib/webrick/httputils.rb#31
2244
+ def normalize_path(path); end
2245
+
2246
+ # Parses form data in +io+ with the given +boundary+
2247
+ #
2248
+ # source://webrick//lib/webrick/httputils.rb#395
2249
+ def parse_form_data(io, boundary); end
2250
+
2251
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
2252
+ # of values.
2253
+ #
2254
+ # source://webrick//lib/webrick/httputils.rb#145
2255
+ def parse_header(raw); end
2256
+
2257
+ # Parses the query component of a URI in +str+
2258
+ #
2259
+ # source://webrick//lib/webrick/httputils.rb#371
2260
+ def parse_query(str); end
2261
+
2262
+ # Parses q values in +value+ as used in Accept headers.
2263
+ #
2264
+ # source://webrick//lib/webrick/httputils.rb#202
2265
+ def parse_qvalues(value); end
2266
+
2267
+ # Parses a Range header value +ranges_specifier+
2268
+ #
2269
+ # source://webrick//lib/webrick/httputils.rb#184
2270
+ def parse_range_header(ranges_specifier); end
2271
+
2272
+ # Quotes and escapes quotes in +str+
2273
+ #
2274
+ # source://webrick//lib/webrick/httputils.rb#233
2275
+ def quote(str); end
2276
+
2277
+ # Splits a header value +str+ according to HTTP specification.
2278
+ #
2279
+ # source://webrick//lib/webrick/httputils.rb#175
2280
+ def split_header_value(str); end
2281
+
2282
+ # Unescapes HTTP reserved and unwise characters in +str+
2283
+ #
2284
+ # source://webrick//lib/webrick/httputils.rb#474
2285
+ def unescape(str); end
2286
+
2287
+ # Unescapes form reserved characters in +str+
2288
+ #
2289
+ # source://webrick//lib/webrick/httputils.rb#490
2290
+ def unescape_form(str); end
2291
+ end
2292
+ end
2293
+
2294
+ # Stores multipart form data. FormData objects are created when
2295
+ # WEBrick::HTTPUtils.parse_form_data is called.
2296
+ #
2297
+ # source://webrick//lib/webrick/httputils.rb#242
2298
+ class WEBrick::HTTPUtils::FormData < ::String
2299
+ # Creates a new FormData object.
2300
+ #
2301
+ # +args+ is an Array of form data entries. One FormData will be created
2302
+ # for each entry.
2303
+ #
2304
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
2305
+ #
2306
+ # @return [FormData] a new instance of FormData
2307
+ #
2308
+ # source://webrick//lib/webrick/httputils.rb#267
2309
+ def initialize(*args); end
2310
+
2311
+ # Adds +str+ to this FormData which may be the body, a header or a
2312
+ # header entry.
2313
+ #
2314
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
2315
+ #
2316
+ # source://webrick//lib/webrick/httputils.rb#300
2317
+ def <<(str); end
2318
+
2319
+ # Retrieves the header at the first entry in +key+
2320
+ #
2321
+ # source://webrick//lib/webrick/httputils.rb#286
2322
+ def [](*key); end
2323
+
2324
+ # Adds +data+ at the end of the chain of entries
2325
+ #
2326
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you.
2327
+ #
2328
+ # source://webrick//lib/webrick/httputils.rb#320
2329
+ def append_data(data); end
2330
+
2331
+ # Yields each entry in this FormData
2332
+ #
2333
+ # source://webrick//lib/webrick/httputils.rb#335
2334
+ def each_data; end
2335
+
2336
+ # The filename of the form data part
2337
+ #
2338
+ # source://webrick//lib/webrick/httputils.rb#254
2339
+ def filename; end
2340
+
2341
+ # The filename of the form data part
2342
+ #
2343
+ # source://webrick//lib/webrick/httputils.rb#254
2344
+ def filename=(_arg0); end
2345
+
2346
+ # Returns all the FormData as an Array
2347
+ #
2348
+ # source://webrick//lib/webrick/httputils.rb#347
2349
+ def list; end
2350
+
2351
+ # The name of the form data part
2352
+ #
2353
+ # source://webrick//lib/webrick/httputils.rb#249
2354
+ def name; end
2355
+
2356
+ # The name of the form data part
2357
+ #
2358
+ # source://webrick//lib/webrick/httputils.rb#249
2359
+ def name=(_arg0); end
2360
+
2361
+ # source://webrick//lib/webrick/httputils.rb#256
2362
+ def next_data=(_arg0); end
2363
+
2364
+ # Returns all the FormData as an Array
2365
+ #
2366
+ # A FormData will behave like an Array
2367
+ #
2368
+ # source://webrick//lib/webrick/httputils.rb#347
2369
+ def to_ary; end
2370
+
2371
+ # This FormData's body
2372
+ #
2373
+ # source://webrick//lib/webrick/httputils.rb#363
2374
+ def to_s; end
2375
+
2376
+ protected
2377
+
2378
+ # source://webrick//lib/webrick/httputils.rb#256
2379
+ def next_data; end
2380
+ end
2381
+
2382
+ # source://webrick//lib/webrick/utils.rb#17
2383
+ module WEBrick::Utils
2384
+ private
2385
+
2386
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
2387
+ #
2388
+ # It will create IPV4 and IPV6 sockets on all interfaces.
2389
+ #
2390
+ # source://webrick//lib/webrick/utils.rb#56
2391
+ def create_listeners(address, port); end
2392
+
2393
+ # The server hostname
2394
+ #
2395
+ # source://webrick//lib/webrick/utils.rb#47
2396
+ def getservername; end
2397
+
2398
+ # Generates a random string of length +len+
2399
+ #
2400
+ # source://webrick//lib/webrick/utils.rb#79
2401
+ def random_string(len); end
2402
+
2403
+ # Sets the close on exec flag for +io+
2404
+ #
2405
+ # source://webrick//lib/webrick/utils.rb#27
2406
+ def set_close_on_exec(io); end
2407
+
2408
+ # Sets IO operations on +io+ to be non-blocking
2409
+ #
2410
+ # source://webrick//lib/webrick/utils.rb#20
2411
+ def set_non_blocking(io); end
2412
+
2413
+ # Changes the process's uid and gid to the ones of +user+
2414
+ #
2415
+ # source://webrick//lib/webrick/utils.rb#34
2416
+ def su(user); end
2417
+
2418
+ # Executes the passed block and raises +exception+ if execution takes more
2419
+ # than +seconds+.
2420
+ #
2421
+ # If +seconds+ is zero or nil, simply executes the block
2422
+ #
2423
+ # source://webrick//lib/webrick/utils.rb#253
2424
+ def timeout(seconds, exception = T.unsafe(nil)); end
2425
+
2426
+ class << self
2427
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
2428
+ #
2429
+ # It will create IPV4 and IPV6 sockets on all interfaces.
2430
+ #
2431
+ # source://webrick//lib/webrick/utils.rb#56
2432
+ def create_listeners(address, port); end
2433
+
2434
+ # The server hostname
2435
+ #
2436
+ # source://webrick//lib/webrick/utils.rb#47
2437
+ def getservername; end
2438
+
2439
+ # Generates a random string of length +len+
2440
+ #
2441
+ # source://webrick//lib/webrick/utils.rb#79
2442
+ def random_string(len); end
2443
+
2444
+ # Sets the close on exec flag for +io+
2445
+ #
2446
+ # source://webrick//lib/webrick/utils.rb#27
2447
+ def set_close_on_exec(io); end
2448
+
2449
+ # Sets IO operations on +io+ to be non-blocking
2450
+ #
2451
+ # source://webrick//lib/webrick/utils.rb#20
2452
+ def set_non_blocking(io); end
2453
+
2454
+ # Changes the process's uid and gid to the ones of +user+
2455
+ #
2456
+ # source://webrick//lib/webrick/utils.rb#34
2457
+ def su(user); end
2458
+
2459
+ # Executes the passed block and raises +exception+ if execution takes more
2460
+ # than +seconds+.
2461
+ #
2462
+ # If +seconds+ is zero or nil, simply executes the block
2463
+ #
2464
+ # source://webrick//lib/webrick/utils.rb#253
2465
+ def timeout(seconds, exception = T.unsafe(nil)); end
2466
+ end
2467
+ end
2468
+
2469
+ # Class used to manage timeout handlers across multiple threads.
2470
+ #
2471
+ # Timeout handlers should be managed by using the class methods which are
2472
+ # synchronized.
2473
+ #
2474
+ # id = TimeoutHandler.register(10, Timeout::Error)
2475
+ # begin
2476
+ # sleep 20
2477
+ # puts 'foo'
2478
+ # ensure
2479
+ # TimeoutHandler.cancel(id)
2480
+ # end
2481
+ #
2482
+ # will raise Timeout::Error
2483
+ #
2484
+ # id = TimeoutHandler.register(10, Timeout::Error)
2485
+ # begin
2486
+ # sleep 5
2487
+ # puts 'foo'
2488
+ # ensure
2489
+ # TimeoutHandler.cancel(id)
2490
+ # end
2491
+ #
2492
+ # will print 'foo'
2493
+ #
2494
+ # source://webrick//lib/webrick/utils.rb#118
2495
+ class WEBrick::Utils::TimeoutHandler
2496
+ include ::Singleton
2497
+ extend ::Singleton::SingletonClassMethods
2498
+
2499
+ # Creates a new TimeoutHandler. You should use ::register and ::cancel
2500
+ # instead of creating the timeout handler directly.
2501
+ #
2502
+ # @return [TimeoutHandler] a new instance of TimeoutHandler
2503
+ #
2504
+ # source://webrick//lib/webrick/utils.rb#148
2505
+ def initialize; end
2506
+
2507
+ # Cancels the timeout handler +id+
2508
+ #
2509
+ # source://webrick//lib/webrick/utils.rb#226
2510
+ def cancel(thread, id); end
2511
+
2512
+ # Interrupts the timeout handler +id+ and raises +exception+
2513
+ #
2514
+ # source://webrick//lib/webrick/utils.rb#203
2515
+ def interrupt(thread, id, exception); end
2516
+
2517
+ # Registers a new timeout handler
2518
+ #
2519
+ # +time+:: Timeout in seconds
2520
+ # +exception+:: Exception to raise when timeout elapsed
2521
+ #
2522
+ # source://webrick//lib/webrick/utils.rb#214
2523
+ def register(thread, time, exception); end
2524
+
2525
+ # source://webrick//lib/webrick/utils.rb#240
2526
+ def terminate; end
2527
+
2528
+ private
2529
+
2530
+ # source://webrick//lib/webrick/utils.rb#158
2531
+ def watch; end
2532
+
2533
+ # source://webrick//lib/webrick/utils.rb#193
2534
+ def watcher; end
2535
+
2536
+ class << self
2537
+ # Cancels the timeout handler +id+
2538
+ #
2539
+ # source://webrick//lib/webrick/utils.rb#137
2540
+ def cancel(id); end
2541
+
2542
+ # Registers a new timeout handler
2543
+ #
2544
+ # +time+:: Timeout in seconds
2545
+ # +exception+:: Exception to raise when timeout elapsed
2546
+ #
2547
+ # source://webrick//lib/webrick/utils.rb#130
2548
+ def register(seconds, exception); end
2549
+
2550
+ # source://webrick//lib/webrick/utils.rb#141
2551
+ def terminate; end
2552
+ end
2553
+ end