danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,1802 @@
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
+ module WEBrick::AccessLog
23
+ private
24
+
25
+ # Escapes control characters in +data+
26
+ def escape(data); end
27
+
28
+ # Formats +params+ according to +format_string+ which is described in
29
+ # setup_params.
30
+ def format(format_string, params); end
31
+
32
+ # This format specification is a subset of mod_log_config of Apache:
33
+ #
34
+ # %a:: Remote IP address
35
+ # %b:: Total response size
36
+ # %e{variable}:: Given variable in ENV
37
+ # %f:: Response filename
38
+ # %h:: Remote host name
39
+ # %{header}i:: Given request header
40
+ # %l:: Remote logname, always "-"
41
+ # %m:: Request method
42
+ # %{attr}n:: Given request attribute from <tt>req.attributes</tt>
43
+ # %{header}o:: Given response header
44
+ # %p:: Server's request port
45
+ # %{format}p:: The canonical port of the server serving the request or the
46
+ # actual port or the client's actual port. Valid formats are
47
+ # canonical, local or remote.
48
+ # %q:: Request query string
49
+ # %r:: First line of the request
50
+ # %s:: Request status
51
+ # %t:: Time the request was received
52
+ # %T:: Time taken to process the request
53
+ # %u:: Remote user from auth
54
+ # %U:: Unparsed URI
55
+ # %%:: Literal %
56
+ def setup_params(config, req, res); end
57
+
58
+ class << self
59
+ # Escapes control characters in +data+
60
+ def escape(data); end
61
+
62
+ # Formats +params+ according to +format_string+ which is described in
63
+ # setup_params.
64
+ def format(format_string, params); end
65
+
66
+ # This format specification is a subset of mod_log_config of Apache:
67
+ #
68
+ # %a:: Remote IP address
69
+ # %b:: Total response size
70
+ # %e{variable}:: Given variable in ENV
71
+ # %f:: Response filename
72
+ # %h:: Remote host name
73
+ # %{header}i:: Given request header
74
+ # %l:: Remote logname, always "-"
75
+ # %m:: Request method
76
+ # %{attr}n:: Given request attribute from <tt>req.attributes</tt>
77
+ # %{header}o:: Given response header
78
+ # %p:: Server's request port
79
+ # %{format}p:: The canonical port of the server serving the request or the
80
+ # actual port or the client's actual port. Valid formats are
81
+ # canonical, local or remote.
82
+ # %q:: Request query string
83
+ # %r:: First line of the request
84
+ # %s:: Request status
85
+ # %t:: Time the request was received
86
+ # %T:: Time taken to process the request
87
+ # %u:: Remote user from auth
88
+ # %U:: Unparsed URI
89
+ # %%:: Literal %
90
+ def setup_params(config, req, res); end
91
+ end
92
+ end
93
+
94
+ # A generic logging class
95
+ class WEBrick::BasicLog
96
+ # Initializes a new logger for +log_file+ that outputs messages at +level+
97
+ # or higher. +log_file+ can be a filename, an IO-like object that
98
+ # responds to #<< or nil which outputs to $stderr.
99
+ #
100
+ # If no level is given INFO is chosen by default
101
+ #
102
+ # @return [BasicLog] a new instance of BasicLog
103
+ def initialize(log_file = T.unsafe(nil), level = T.unsafe(nil)); end
104
+
105
+ # Synonym for log(INFO, obj.to_s)
106
+ def <<(obj); end
107
+
108
+ # Closes the logger (also closes the log device associated to the logger)
109
+ def close; end
110
+
111
+ # Shortcut for logging a DEBUG message
112
+ def debug(msg); end
113
+
114
+ # Will the logger output DEBUG messages?
115
+ #
116
+ # @return [Boolean]
117
+ def debug?; end
118
+
119
+ # Shortcut for logging an ERROR message
120
+ def error(msg); end
121
+
122
+ # Will the logger output ERROR messages?
123
+ #
124
+ # @return [Boolean]
125
+ def error?; end
126
+
127
+ # Shortcut for logging a FATAL message
128
+ def fatal(msg); end
129
+
130
+ # Will the logger output FATAL messages?
131
+ #
132
+ # @return [Boolean]
133
+ def fatal?; end
134
+
135
+ # Shortcut for logging an INFO message
136
+ def info(msg); end
137
+
138
+ # Will the logger output INFO messages?
139
+ #
140
+ # @return [Boolean]
141
+ def info?; end
142
+
143
+ # log-level, messages above this level will be logged
144
+ def level; end
145
+
146
+ # log-level, messages above this level will be logged
147
+ def level=(_arg0); end
148
+
149
+ # Logs +data+ at +level+ if the given level is above the current log
150
+ # level.
151
+ def log(level, data); end
152
+
153
+ # Shortcut for logging a WARN message
154
+ def warn(msg); end
155
+
156
+ # Will the logger output WARN messages?
157
+ #
158
+ # @return [Boolean]
159
+ def warn?; end
160
+
161
+ private
162
+
163
+ # Formats +arg+ for the logger
164
+ #
165
+ # * If +arg+ is an Exception, it will format the error message and
166
+ # the back trace.
167
+ # * If +arg+ responds to #to_str, it will return it.
168
+ # * Otherwise it will return +arg+.inspect.
169
+ def format(arg); end
170
+ end
171
+
172
+ # Base TCP server class. You must subclass GenericServer and provide a #run
173
+ # method.
174
+ class WEBrick::GenericServer
175
+ # Creates a new generic server from +config+. The default configuration
176
+ # comes from +default+.
177
+ #
178
+ # @return [GenericServer] a new instance of GenericServer
179
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
180
+
181
+ # Retrieves +key+ from the configuration
182
+ def [](key); end
183
+
184
+ # The server configuration
185
+ def config; end
186
+
187
+ # Adds listeners from +address+ and +port+ to the server. See
188
+ # WEBrick::Utils::create_listeners for details.
189
+ def listen(address, port); end
190
+
191
+ # Sockets listening for connections.
192
+ def listeners; end
193
+
194
+ # The server logger. This is independent from the HTTP access log.
195
+ def logger; end
196
+
197
+ # You must subclass GenericServer and implement \#run which accepts a TCP
198
+ # client socket
199
+ def run(sock); end
200
+
201
+ # Shuts down the server and all listening sockets. New listeners must be
202
+ # provided to restart the server.
203
+ def shutdown; end
204
+
205
+ # Starts the server and runs the +block+ for each connection. This method
206
+ # does not return until the server is stopped from a signal handler or
207
+ # another thread using #stop or #shutdown.
208
+ #
209
+ # If the block raises a subclass of StandardError the exception is logged
210
+ # and ignored. If an IOError or Errno::EBADF exception is raised the
211
+ # exception is ignored. If an Exception subclass is raised the exception
212
+ # is logged and re-raised which stops the server.
213
+ #
214
+ # To completely shut down a server call #shutdown from ensure:
215
+ #
216
+ # server = WEBrick::GenericServer.new
217
+ # # or WEBrick::HTTPServer.new
218
+ #
219
+ # begin
220
+ # server.start
221
+ # ensure
222
+ # server.shutdown
223
+ # end
224
+ #
225
+ # @raise [ServerError]
226
+ def start(&block); end
227
+
228
+ # The server status. One of :Stop, :Running or :Shutdown
229
+ def status; end
230
+
231
+ # Stops the server from accepting new connections.
232
+ def stop; end
233
+
234
+ # Tokens control the number of outstanding clients. The
235
+ # <code>:MaxClients</code> configuration sets this.
236
+ def tokens; end
237
+
238
+ private
239
+
240
+ # Accepts a TCP client socket from the TCP server socket +svr+ and returns
241
+ # the client socket.
242
+ def accept_client(svr); end
243
+
244
+ def alarm_shutdown_pipe; end
245
+
246
+ # Calls the callback +callback_name+ from the configuration with +args+
247
+ def call_callback(callback_name, *args); end
248
+
249
+ def cleanup_listener; end
250
+ def cleanup_shutdown_pipe(shutdown_pipe); end
251
+ def setup_shutdown_pipe; end
252
+
253
+ # Starts a server thread for the client socket +sock+ that runs the given
254
+ # +block+.
255
+ #
256
+ # Sets the socket to the <code>:WEBrickSocket</code> thread local variable
257
+ # in the thread.
258
+ #
259
+ # If any errors occur in the block they are logged and handled.
260
+ def start_thread(sock, &block); end
261
+ end
262
+
263
+ module WEBrick::HTMLUtils
264
+ private
265
+
266
+ # Escapes &, ", > and < in +string+
267
+ def escape(string); end
268
+
269
+ class << self
270
+ # Escapes &, ", > and < in +string+
271
+ def escape(string); end
272
+ end
273
+ end
274
+
275
+ # HTTPAuth provides both basic and digest authentication.
276
+ #
277
+ # To enable authentication for requests in WEBrick you will need a user
278
+ # database and an authenticator. To start, here's an Htpasswd database for
279
+ # use with a DigestAuth authenticator:
280
+ #
281
+ # config = { :Realm => 'DigestAuth example realm' }
282
+ #
283
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
284
+ # htpasswd.auth_type = WEBrick::HTTPAuth::DigestAuth
285
+ # htpasswd.set_passwd config[:Realm], 'username', 'password'
286
+ # htpasswd.flush
287
+ #
288
+ # The +:Realm+ is used to provide different access to different groups
289
+ # across several resources on a server. Typically you'll need only one
290
+ # realm for a server.
291
+ #
292
+ # This database can be used to create an authenticator:
293
+ #
294
+ # config[:UserDB] = htpasswd
295
+ #
296
+ # digest_auth = WEBrick::HTTPAuth::DigestAuth.new config
297
+ #
298
+ # To authenticate a request call #authenticate with a request and response
299
+ # object in a servlet:
300
+ #
301
+ # def do_GET req, res
302
+ # @authenticator.authenticate req, res
303
+ # end
304
+ #
305
+ # For digest authentication the authenticator must not be created every
306
+ # request, it must be passed in as an option via WEBrick::HTTPServer#mount.
307
+ module WEBrick::HTTPAuth
308
+ private
309
+
310
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
311
+
312
+ # Simple wrapper for providing basic authentication for a request. When
313
+ # called with a request +req+, response +res+, authentication +realm+ and
314
+ # +block+ the block will be called with a +username+ and +password+. If
315
+ # the block returns true the request is allowed to continue, otherwise an
316
+ # HTTPStatus::Unauthorized error is raised.
317
+ def basic_auth(req, res, realm, &block); end
318
+
319
+ # Simple wrapper for providing basic authentication for a proxied request.
320
+ # When called with a request +req+, response +res+, authentication +realm+
321
+ # and +block+ the block will be called with a +username+ and +password+.
322
+ # If the block returns true the request is allowed to continue, otherwise
323
+ # an HTTPStatus::ProxyAuthenticationRequired error is raised.
324
+ def proxy_basic_auth(req, res, realm, &block); end
325
+
326
+ class << self
327
+ def _basic_auth(req, res, realm, req_field, res_field, err_type, block); end
328
+
329
+ # Simple wrapper for providing basic authentication for a request. When
330
+ # called with a request +req+, response +res+, authentication +realm+ and
331
+ # +block+ the block will be called with a +username+ and +password+. If
332
+ # the block returns true the request is allowed to continue, otherwise an
333
+ # HTTPStatus::Unauthorized error is raised.
334
+ def basic_auth(req, res, realm, &block); end
335
+
336
+ # Simple wrapper for providing basic authentication for a proxied request.
337
+ # When called with a request +req+, response +res+, authentication +realm+
338
+ # and +block+ the block will be called with a +username+ and +password+.
339
+ # If the block returns true the request is allowed to continue, otherwise
340
+ # an HTTPStatus::ProxyAuthenticationRequired error is raised.
341
+ def proxy_basic_auth(req, res, realm, &block); end
342
+ end
343
+ end
344
+
345
+ # Module providing generic support for both Digest and Basic
346
+ # authentication schemes.
347
+ module WEBrick::HTTPAuth::Authenticator
348
+ # The logger for this authenticator
349
+ def logger; end
350
+
351
+ # The realm this authenticator covers
352
+ def realm; end
353
+
354
+ # The user database for this authenticator
355
+ def userdb; end
356
+
357
+ private
358
+
359
+ # Initializes the authenticator from +config+
360
+ def check_init(config); end
361
+
362
+ # Ensures +req+ has credentials that can be authenticated.
363
+ def check_scheme(req); end
364
+
365
+ def error(fmt, *args); end
366
+ def info(fmt, *args); end
367
+ def log(meth, fmt, *args); end
368
+ end
369
+
370
+ WEBrick::HTTPAuth::Authenticator::AuthException = WEBrick::HTTPStatus::Unauthorized
371
+
372
+ # Basic Authentication for WEBrick
373
+ #
374
+ # Use this class to add basic authentication to a WEBrick servlet.
375
+ #
376
+ # Here is an example of how to set up a BasicAuth:
377
+ #
378
+ # config = { :Realm => 'BasicAuth example realm' }
379
+ #
380
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file', password_hash: :bcrypt
381
+ # htpasswd.set_passwd config[:Realm], 'username', 'password'
382
+ # htpasswd.flush
383
+ #
384
+ # config[:UserDB] = htpasswd
385
+ #
386
+ # basic_auth = WEBrick::HTTPAuth::BasicAuth.new config
387
+ class WEBrick::HTTPAuth::BasicAuth
388
+ include ::WEBrick::HTTPAuth::Authenticator
389
+
390
+ # Creates a new BasicAuth instance.
391
+ #
392
+ # See WEBrick::Config::BasicAuth for default configuration entries
393
+ #
394
+ # You must supply the following configuration entries:
395
+ #
396
+ # :Realm:: The name of the realm being protected.
397
+ # :UserDB:: A database of usernames and passwords.
398
+ # A WEBrick::HTTPAuth::Htpasswd instance should be used.
399
+ #
400
+ # @return [BasicAuth] a new instance of BasicAuth
401
+ def initialize(config, default = T.unsafe(nil)); end
402
+
403
+ # Authenticates a +req+ and returns a 401 Unauthorized using +res+ if
404
+ # the authentication was not correct.
405
+ def authenticate(req, res); end
406
+
407
+ # Returns a challenge response which asks for authentication information
408
+ #
409
+ # @raise [@auth_exception]
410
+ def challenge(req, res); end
411
+
412
+ # Returns the value of attribute logger.
413
+ def logger; end
414
+
415
+ # Returns the value of attribute realm.
416
+ def realm; end
417
+
418
+ # Returns the value of attribute userdb.
419
+ def userdb; end
420
+
421
+ class << self
422
+ # Used by UserDB to create a basic password entry
423
+ def make_passwd(realm, user, pass); end
424
+ end
425
+ end
426
+
427
+ # RFC 2617 Digest Access Authentication for WEBrick
428
+ #
429
+ # Use this class to add digest authentication to a WEBrick servlet.
430
+ #
431
+ # Here is an example of how to set up DigestAuth:
432
+ #
433
+ # config = { :Realm => 'DigestAuth example realm' }
434
+ #
435
+ # htdigest = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
436
+ # htdigest.set_passwd config[:Realm], 'username', 'password'
437
+ # htdigest.flush
438
+ #
439
+ # config[:UserDB] = htdigest
440
+ #
441
+ # digest_auth = WEBrick::HTTPAuth::DigestAuth.new config
442
+ #
443
+ # When using this as with a servlet be sure not to create a new DigestAuth
444
+ # object in the servlet's #initialize. By default WEBrick creates a new
445
+ # servlet instance for every request and the DigestAuth object must be
446
+ # used across requests.
447
+ class WEBrick::HTTPAuth::DigestAuth
448
+ include ::WEBrick::HTTPAuth::Authenticator
449
+
450
+ # Creates a new DigestAuth instance. Be sure to use the same DigestAuth
451
+ # instance for multiple requests as it saves state between requests in
452
+ # order to perform authentication.
453
+ #
454
+ # See WEBrick::Config::DigestAuth for default configuration entries
455
+ #
456
+ # You must supply the following configuration entries:
457
+ #
458
+ # :Realm:: The name of the realm being protected.
459
+ # :UserDB:: A database of usernames and passwords.
460
+ # A WEBrick::HTTPAuth::Htdigest instance should be used.
461
+ #
462
+ # @return [DigestAuth] a new instance of DigestAuth
463
+ def initialize(config, default = T.unsafe(nil)); end
464
+
465
+ # Digest authentication algorithm
466
+ def algorithm; end
467
+
468
+ # Authenticates a +req+ and returns a 401 Unauthorized using +res+ if
469
+ # the authentication was not correct.
470
+ def authenticate(req, res); end
471
+
472
+ # Returns a challenge response which asks for authentication information
473
+ #
474
+ # @raise [@auth_exception]
475
+ def challenge(req, res, stale = T.unsafe(nil)); end
476
+
477
+ # Quality of protection. RFC 2617 defines "auth" and "auth-int"
478
+ def qop; end
479
+
480
+ private
481
+
482
+ def _authenticate(req, res); end
483
+ def check_nonce(req, auth_req); end
484
+ def check_opaque(opaque_struct, req, auth_req); end
485
+ def check_uri(req, auth_req); end
486
+ def generate_next_nonce(req); end
487
+ def generate_opaque(req); end
488
+ def hexdigest(*args); end
489
+ def split_param_value(string); end
490
+
491
+ class << self
492
+ # Used by UserDB to create a digest password entry
493
+ def make_passwd(realm, user, pass); end
494
+ end
495
+ end
496
+
497
+ # Struct containing the opaque portion of the digest authentication
498
+ class WEBrick::HTTPAuth::DigestAuth::OpaqueInfo < ::Struct
499
+ # Sets the attribute nc
500
+ #
501
+ # @param value [Object] the value to set the attribute nc to.
502
+ # @return [Object] the newly set value
503
+ def nc=(_); end
504
+
505
+ # Sets the attribute nonce
506
+ #
507
+ # @param value [Object] the value to set the attribute nonce to.
508
+ # @return [Object] the newly set value
509
+ def nonce=(_); end
510
+
511
+ # Sets the attribute time
512
+ #
513
+ # @param value [Object] the value to set the attribute time to.
514
+ # @return [Object] the newly set value
515
+ def time=(_); end
516
+ end
517
+
518
+ # Htdigest accesses apache-compatible digest password files. Passwords are
519
+ # matched to a realm where they are valid. For security, the path for a
520
+ # digest password database should be stored outside of the paths available
521
+ # to the HTTP server.
522
+ #
523
+ # Htdigest is intended for use with WEBrick::HTTPAuth::DigestAuth and
524
+ # stores passwords using cryptographic hashes.
525
+ #
526
+ # htpasswd = WEBrick::HTTPAuth::Htdigest.new 'my_password_file'
527
+ # htpasswd.set_passwd 'my realm', 'username', 'password'
528
+ # htpasswd.flush
529
+ class WEBrick::HTTPAuth::Htdigest
530
+ include ::WEBrick::HTTPAuth::UserDB
531
+
532
+ # Open a digest password database at +path+
533
+ #
534
+ # @return [Htdigest] a new instance of Htdigest
535
+ def initialize(path); end
536
+
537
+ # Removes a password from the database for +user+ in +realm+.
538
+ def delete_passwd(realm, user); end
539
+
540
+ # Iterate passwords in the database.
541
+ def each; end
542
+
543
+ # Flush the password database. If +output+ is given the database will
544
+ # be written there instead of to the original path.
545
+ def flush(output = T.unsafe(nil)); end
546
+
547
+ # Retrieves a password from the database for +user+ in +realm+. If
548
+ # +reload_db+ is true the database will be reloaded first.
549
+ def get_passwd(realm, user, reload_db); end
550
+
551
+ # Reloads passwords from the database
552
+ def reload; end
553
+
554
+ # Sets a password in the database for +user+ in +realm+ to +pass+.
555
+ def set_passwd(realm, user, pass); end
556
+ end
557
+
558
+ # Htgroup accesses apache-compatible group files. Htgroup can be used to
559
+ # provide group-based authentication for users. Currently Htgroup is not
560
+ # directly integrated with any authenticators in WEBrick. For security,
561
+ # the path for a digest password database should be stored outside of the
562
+ # paths available to the HTTP server.
563
+ #
564
+ # Example:
565
+ #
566
+ # htgroup = WEBrick::HTTPAuth::Htgroup.new 'my_group_file'
567
+ # htgroup.add 'superheroes', %w[spiderman batman]
568
+ #
569
+ # htgroup.members('superheroes').include? 'magneto' # => false
570
+ class WEBrick::HTTPAuth::Htgroup
571
+ # Open a group database at +path+
572
+ #
573
+ # @return [Htgroup] a new instance of Htgroup
574
+ def initialize(path); end
575
+
576
+ # Add an Array of +members+ to +group+
577
+ def add(group, members); end
578
+
579
+ # Flush the group database. If +output+ is given the database will be
580
+ # written there instead of to the original path.
581
+ def flush(output = T.unsafe(nil)); end
582
+
583
+ # Retrieve the list of members from +group+
584
+ def members(group); end
585
+
586
+ # Reload groups from the database
587
+ def reload; end
588
+ end
589
+
590
+ # Htpasswd accesses apache-compatible password files. Passwords are
591
+ # matched to a realm where they are valid. For security, the path for a
592
+ # password database should be stored outside of the paths available to the
593
+ # HTTP server.
594
+ #
595
+ # Htpasswd is intended for use with WEBrick::HTTPAuth::BasicAuth.
596
+ #
597
+ # To create an Htpasswd database with a single user:
598
+ #
599
+ # htpasswd = WEBrick::HTTPAuth::Htpasswd.new 'my_password_file'
600
+ # htpasswd.set_passwd 'my realm', 'username', 'password'
601
+ # htpasswd.flush
602
+ class WEBrick::HTTPAuth::Htpasswd
603
+ include ::WEBrick::HTTPAuth::UserDB
604
+
605
+ # Open a password database at +path+
606
+ #
607
+ # @return [Htpasswd] a new instance of Htpasswd
608
+ def initialize(path, password_hash: T.unsafe(nil)); end
609
+
610
+ # Removes a password from the database for +user+ in +realm+.
611
+ def delete_passwd(realm, user); end
612
+
613
+ # Iterate passwords in the database.
614
+ def each; end
615
+
616
+ # Flush the password database. If +output+ is given the database will
617
+ # be written there instead of to the original path.
618
+ def flush(output = T.unsafe(nil)); end
619
+
620
+ # Retrieves a password from the database for +user+ in +realm+. If
621
+ # +reload_db+ is true the database will be reloaded first.
622
+ def get_passwd(realm, user, reload_db); end
623
+
624
+ # Reload passwords from the database
625
+ def reload; end
626
+
627
+ # Sets a password in the database for +user+ in +realm+ to +pass+.
628
+ def set_passwd(realm, user, pass); end
629
+ end
630
+
631
+ WEBrick::HTTPAuth::ProxyAuthenticator::AuthException = WEBrick::HTTPStatus::ProxyAuthenticationRequired
632
+
633
+ # Basic authentication for proxy servers. See BasicAuth for details.
634
+ class WEBrick::HTTPAuth::ProxyBasicAuth < ::WEBrick::HTTPAuth::BasicAuth
635
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
636
+ end
637
+
638
+ # Digest authentication for proxy servers. See DigestAuth for details.
639
+ class WEBrick::HTTPAuth::ProxyDigestAuth < ::WEBrick::HTTPAuth::DigestAuth
640
+ include ::WEBrick::HTTPAuth::ProxyAuthenticator
641
+
642
+ private
643
+
644
+ def check_uri(req, auth_req); end
645
+ end
646
+
647
+ # User database mixin for HTTPAuth. This mixin dispatches user record
648
+ # access to the underlying auth_type for this database.
649
+ module WEBrick::HTTPAuth::UserDB
650
+ # The authentication type.
651
+ #
652
+ # WEBrick::HTTPAuth::BasicAuth or WEBrick::HTTPAuth::DigestAuth are
653
+ # built-in.
654
+ def auth_type; end
655
+
656
+ # The authentication type.
657
+ #
658
+ # WEBrick::HTTPAuth::BasicAuth or WEBrick::HTTPAuth::DigestAuth are
659
+ # built-in.
660
+ def auth_type=(_arg0); end
661
+
662
+ # Retrieves a password in +realm+ for +user+ for the auth_type of this
663
+ # database. +reload_db+ is a dummy value.
664
+ def get_passwd(realm, user, reload_db = T.unsafe(nil)); end
665
+
666
+ # Creates an obscured password in +realm+ with +user+ and +password+
667
+ # using the auth_type of this database.
668
+ def make_passwd(realm, user, pass); end
669
+
670
+ # Sets a password in +realm+ with +user+ and +password+ for the
671
+ # auth_type of this database.
672
+ def set_passwd(realm, user, pass); end
673
+ end
674
+
675
+ # --
676
+ # Adds SSL functionality to WEBrick::HTTPRequest
677
+ class WEBrick::HTTPRequest
678
+ # Creates a new HTTP request. WEBrick::Config::HTTP is the default
679
+ # configuration.
680
+ #
681
+ # @return [HTTPRequest] a new instance of HTTPRequest
682
+ def initialize(config); end
683
+
684
+ # Retrieves +header_name+
685
+ def [](header_name); end
686
+
687
+ # The Accept header value
688
+ def accept; end
689
+
690
+ # The Accept-Charset header value
691
+ def accept_charset; end
692
+
693
+ # The Accept-Encoding header value
694
+ def accept_encoding; end
695
+
696
+ # The Accept-Language header value
697
+ def accept_language; end
698
+
699
+ # The socket address of the server
700
+ def addr; end
701
+
702
+ # Hash of request attributes
703
+ def attributes; end
704
+
705
+ # Returns the request body.
706
+ def body(&block); end
707
+
708
+ # Prepares the HTTPRequest object for use as the
709
+ # source for IO.copy_stream
710
+ def body_reader; end
711
+
712
+ # The content-length header
713
+ def content_length; end
714
+
715
+ # The content-type header
716
+ def content_type; end
717
+
718
+ # Generate HTTP/1.1 100 continue response if the client expects it,
719
+ # otherwise does nothing.
720
+ def continue; end
721
+
722
+ # The parsed request cookies
723
+ def cookies; end
724
+
725
+ # Iterates over the request headers
726
+ def each; end
727
+
728
+ # Consumes any remaining body and updates keep-alive status
729
+ def fixup; end
730
+
731
+ # The parsed header of the request
732
+ def header; end
733
+
734
+ # The host this request is for
735
+ def host; end
736
+
737
+ # The HTTP version of the request
738
+ def http_version; end
739
+
740
+ # Is this a keep-alive connection?
741
+ def keep_alive; end
742
+
743
+ # Should the connection this request was made on be kept alive?
744
+ #
745
+ # @return [Boolean]
746
+ def keep_alive?; end
747
+
748
+ # This method provides the metavariables defined by the revision 3
749
+ # of "The WWW Common Gateway Interface Version 1.1"
750
+ # To browse the current document of CGI Version 1.1, see below:
751
+ # http://tools.ietf.org/html/rfc3875
752
+ def meta_vars; end
753
+
754
+ # Parses a request from +socket+. This is called internally by
755
+ # WEBrick::HTTPServer.
756
+ def parse(socket = T.unsafe(nil)); end
757
+
758
+ # The request path
759
+ def path; end
760
+
761
+ # The path info (CGI variable)
762
+ def path_info; end
763
+
764
+ # The path info (CGI variable)
765
+ def path_info=(_arg0); end
766
+
767
+ # The socket address of the client
768
+ def peeraddr; end
769
+
770
+ # The port this request is for
771
+ def port; end
772
+
773
+ # Request query as a Hash
774
+ def query; end
775
+
776
+ # The query from the URI of the request
777
+ def query_string; end
778
+
779
+ # The query from the URI of the request
780
+ def query_string=(_arg0); end
781
+
782
+ # The raw header of the request
783
+ def raw_header; end
784
+
785
+ # for IO.copy_stream.
786
+ def readpartial(size, buf = T.unsafe(nil)); end
787
+
788
+ # The client's IP address
789
+ def remote_ip; end
790
+
791
+ # The complete request line such as:
792
+ #
793
+ # GET / HTTP/1.1
794
+ def request_line; end
795
+
796
+ # The request method, GET, POST, PUT, etc.
797
+ def request_method; end
798
+
799
+ # The local time this request was received
800
+ def request_time; end
801
+
802
+ # The parsed URI of the request
803
+ def request_uri; end
804
+
805
+ # The script name (CGI variable)
806
+ def script_name; end
807
+
808
+ # The script name (CGI variable)
809
+ def script_name=(_arg0); end
810
+
811
+ # The server name this request is for
812
+ def server_name; end
813
+
814
+ # Is this an SSL request?
815
+ #
816
+ # @return [Boolean]
817
+ def ssl?; end
818
+
819
+ def to_s; end
820
+
821
+ # The unparsed URI of the request
822
+ def unparsed_uri; end
823
+
824
+ # The remote user (CGI variable)
825
+ def user; end
826
+
827
+ # The remote user (CGI variable)
828
+ def user=(_arg0); end
829
+
830
+ private
831
+
832
+ def _read_data(io, method, *arg); end
833
+ def parse_query; end
834
+ def parse_uri(str, scheme = T.unsafe(nil)); end
835
+ def read_body(socket, block); end
836
+ def read_chunk_size(socket); end
837
+ def read_chunked(socket, block); end
838
+ def read_data(io, size); end
839
+ def read_header(socket); end
840
+ def read_line(io, size = T.unsafe(nil)); end
841
+
842
+ # @raise [HTTPStatus::EOFError]
843
+ def read_request_line(socket); end
844
+
845
+ # It's said that all X-Forwarded-* headers will contain more than one
846
+ # (comma-separated) value if the original request already contained one of
847
+ # these headers. Since we could use these values as Host header, we choose
848
+ # the initial(first) value. (apr_table_mergen() adds new value after the
849
+ # existing value with ", " prefix)
850
+ def setup_forwarded_info; end
851
+ end
852
+
853
+ # same as Mongrel, Thin and Puma
854
+ WEBrick::HTTPRequest::MAX_HEADER_LENGTH = T.let(T.unsafe(nil), Integer)
855
+
856
+ # An HTTP response. This is filled in by the service or do_* methods of a
857
+ # WEBrick HTTP Servlet.
858
+ class WEBrick::HTTPResponse
859
+ # Creates a new HTTP response object. WEBrick::Config::HTTP is the
860
+ # default configuration.
861
+ #
862
+ # @return [HTTPResponse] a new instance of HTTPResponse
863
+ def initialize(config); end
864
+
865
+ # Retrieves the response header +field+
866
+ def [](field); end
867
+
868
+ # Sets the response header +field+ to +value+
869
+ def []=(field, value); end
870
+
871
+ # Body may be:
872
+ # * a String;
873
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
874
+ # * a Proc-like object that responds to +#call+.
875
+ #
876
+ # In the latter case, either #chunked= should be set to +true+,
877
+ # or <code>header['content-length']</code> explicitly provided.
878
+ # Example:
879
+ #
880
+ # server.mount_proc '/' do |req, res|
881
+ # res.chunked = true
882
+ # # or
883
+ # # res.header['content-length'] = 10
884
+ # res.body = proc { |out| out.write(Time.now.to_s) }
885
+ # end
886
+ def body; end
887
+
888
+ # Body may be:
889
+ # * a String;
890
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
891
+ # * a Proc-like object that responds to +#call+.
892
+ #
893
+ # In the latter case, either #chunked= should be set to +true+,
894
+ # or <code>header['content-length']</code> explicitly provided.
895
+ # Example:
896
+ #
897
+ # server.mount_proc '/' do |req, res|
898
+ # res.chunked = true
899
+ # # or
900
+ # # res.header['content-length'] = 10
901
+ # res.body = proc { |out| out.write(Time.now.to_s) }
902
+ # end
903
+ def body=(_arg0); end
904
+
905
+ # Enables chunked transfer encoding.
906
+ def chunked=(val); end
907
+
908
+ # Will this response body be returned using chunked transfer-encoding?
909
+ #
910
+ # @return [Boolean]
911
+ def chunked?; end
912
+
913
+ # Configuration for this response
914
+ def config; end
915
+
916
+ # The content-length header
917
+ def content_length; end
918
+
919
+ # Sets the content-length header to +len+
920
+ def content_length=(len); end
921
+
922
+ # The content-type header
923
+ def content_type; end
924
+
925
+ # Sets the content-type header to +type+
926
+ def content_type=(type); end
927
+
928
+ # Response cookies
929
+ def cookies; end
930
+
931
+ # Iterates over each header in the response
932
+ def each; end
933
+
934
+ # Filename of the static file in this response. Only used by the
935
+ # FileHandler servlet.
936
+ def filename; end
937
+
938
+ # Filename of the static file in this response. Only used by the
939
+ # FileHandler servlet.
940
+ def filename=(_arg0); end
941
+
942
+ # Response header
943
+ def header; end
944
+
945
+ # HTTP Response version
946
+ def http_version; end
947
+
948
+ # Is this a keep-alive response?
949
+ def keep_alive; end
950
+
951
+ # Is this a keep-alive response?
952
+ def keep_alive=(_arg0); end
953
+
954
+ # Will this response's connection be kept alive?
955
+ #
956
+ # @return [Boolean]
957
+ def keep_alive?; end
958
+
959
+ def make_body_tempfile; end
960
+
961
+ # Response reason phrase ("OK")
962
+ def reason_phrase; end
963
+
964
+ # Response reason phrase ("OK")
965
+ def reason_phrase=(_arg0); end
966
+
967
+ def remove_body_tempfile; end
968
+
969
+ # Request HTTP version for this response
970
+ def request_http_version; end
971
+
972
+ # Request HTTP version for this response
973
+ def request_http_version=(_arg0); end
974
+
975
+ # Request method for this response
976
+ def request_method; end
977
+
978
+ # Request method for this response
979
+ def request_method=(_arg0); end
980
+
981
+ # Request URI for this response
982
+ def request_uri; end
983
+
984
+ # Request URI for this response
985
+ def request_uri=(_arg0); end
986
+
987
+ # Sends the body on +socket+
988
+ def send_body(socket); end
989
+
990
+ # Sends the headers on +socket+
991
+ def send_header(socket); end
992
+
993
+ # Sends the response on +socket+
994
+ def send_response(socket); end
995
+
996
+ # Bytes sent in this response
997
+ def sent_size; end
998
+
999
+ # Creates an error page for exception +ex+ with an optional +backtrace+
1000
+ def set_error(ex, backtrace = T.unsafe(nil)); end
1001
+
1002
+ # Redirects to +url+ with a WEBrick::HTTPStatus::Redirect +status+.
1003
+ #
1004
+ # Example:
1005
+ #
1006
+ # res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
1007
+ def set_redirect(status, url); end
1008
+
1009
+ # Sets up the headers for sending
1010
+ def setup_header; end
1011
+
1012
+ # Response status code (200)
1013
+ def status; end
1014
+
1015
+ # Sets the response's status to the +status+ code
1016
+ def status=(status); end
1017
+
1018
+ # The response's HTTP status line
1019
+ def status_line; end
1020
+
1021
+ private
1022
+
1023
+ # preserved for compatibility with some 3rd-party handlers
1024
+ def _write_data(socket, data); end
1025
+
1026
+ def check_header(header_value); end
1027
+
1028
+ # :stopdoc:
1029
+ def error_body(backtrace, ex, host, port); end
1030
+
1031
+ def send_body_io(socket); end
1032
+ def send_body_proc(socket); end
1033
+ def send_body_string(socket); end
1034
+ end
1035
+
1036
+ class WEBrick::HTTPResponse::ChunkedWrapper
1037
+ # @return [ChunkedWrapper] a new instance of ChunkedWrapper
1038
+ def initialize(socket, resp); end
1039
+
1040
+ def <<(*buf); end
1041
+ def write(buf); end
1042
+ end
1043
+
1044
+ # --
1045
+ # Adds SSL functionality to WEBrick::HTTPServer
1046
+ class WEBrick::HTTPServer < ::WEBrick::GenericServer
1047
+ # Creates a new HTTP server according to +config+
1048
+ #
1049
+ # An HTTP server uses the following attributes:
1050
+ #
1051
+ # :AccessLog:: An array of access logs. See WEBrick::AccessLog
1052
+ # :BindAddress:: Local address for the server to bind to
1053
+ # :DocumentRoot:: Root path to serve files from
1054
+ # :DocumentRootOptions:: Options for the default HTTPServlet::FileHandler
1055
+ # :HTTPVersion:: The HTTP version of this server
1056
+ # :Port:: Port to listen on
1057
+ # :RequestCallback:: Called with a request and response before each
1058
+ # request is serviced.
1059
+ # :RequestTimeout:: Maximum time to wait between requests
1060
+ # :ServerAlias:: Array of alternate names for this server for virtual
1061
+ # hosting
1062
+ # :ServerName:: Name for this server for virtual hosting
1063
+ #
1064
+ # @return [HTTPServer] a new instance of HTTPServer
1065
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
1066
+
1067
+ # Logs +req+ and +res+ in the access logs. +config+ is used for the
1068
+ # server name.
1069
+ def access_log(config, req, res); end
1070
+
1071
+ # Creates the HTTPRequest used when handling the HTTP
1072
+ # request. Can be overridden by subclasses.
1073
+ def create_request(with_webrick_config); end
1074
+
1075
+ # Creates the HTTPResponse used when handling the HTTP
1076
+ # request. Can be overridden by subclasses.
1077
+ def create_response(with_webrick_config); end
1078
+
1079
+ # The default OPTIONS request handler says GET, HEAD, POST and OPTIONS
1080
+ # requests are allowed.
1081
+ def do_OPTIONS(req, res); end
1082
+
1083
+ # Finds the appropriate virtual host to handle +req+
1084
+ def lookup_server(req); end
1085
+
1086
+ # Mounts +servlet+ on +dir+ passing +options+ to the servlet at creation
1087
+ # time
1088
+ def mount(dir, servlet, *options); end
1089
+
1090
+ # Mounts +proc+ or +block+ on +dir+ and calls it with a
1091
+ # WEBrick::HTTPRequest and WEBrick::HTTPResponse
1092
+ #
1093
+ # @raise [HTTPServerError]
1094
+ def mount_proc(dir, proc = T.unsafe(nil), &block); end
1095
+
1096
+ # Processes requests on +sock+
1097
+ def run(sock); end
1098
+
1099
+ # Finds a servlet for +path+
1100
+ def search_servlet(path); end
1101
+
1102
+ # Services +req+ and fills in +res+
1103
+ #
1104
+ # @raise [HTTPStatus::NotFound]
1105
+ def service(req, res); end
1106
+
1107
+ # Unmounts +dir+
1108
+ def umount(dir); end
1109
+
1110
+ # Unmounts +dir+
1111
+ def unmount(dir); end
1112
+
1113
+ # Adds +server+ as a virtual host.
1114
+ def virtual_host(server); end
1115
+ end
1116
+
1117
+ # Mount table for the path a servlet is mounted on in the directory space
1118
+ # of the server. Users of WEBrick can only access this indirectly via
1119
+ # WEBrick::HTTPServer#mount, WEBrick::HTTPServer#unmount and
1120
+ # WEBrick::HTTPServer#search_servlet
1121
+ class WEBrick::HTTPServer::MountTable
1122
+ # @return [MountTable] a new instance of MountTable
1123
+ def initialize; end
1124
+
1125
+ def [](dir); end
1126
+ def []=(dir, val); end
1127
+ def delete(dir); end
1128
+ def scan(path); end
1129
+
1130
+ private
1131
+
1132
+ def compile; end
1133
+ def normalize(dir); end
1134
+ end
1135
+
1136
+ # AbstractServlet allows HTTP server modules to be reused across multiple
1137
+ # servers and allows encapsulation of functionality.
1138
+ #
1139
+ # By default a servlet will respond to GET, HEAD (through an alias to GET)
1140
+ # and OPTIONS requests.
1141
+ #
1142
+ # By default a new servlet is initialized for every request. A servlet
1143
+ # instance can be reused by overriding ::get_instance in the
1144
+ # AbstractServlet subclass.
1145
+ #
1146
+ # == A Simple Servlet
1147
+ #
1148
+ # class Simple < WEBrick::HTTPServlet::AbstractServlet
1149
+ # def do_GET request, response
1150
+ # status, content_type, body = do_stuff_with request
1151
+ #
1152
+ # response.status = status
1153
+ # response['Content-Type'] = content_type
1154
+ # response.body = body
1155
+ # end
1156
+ #
1157
+ # def do_stuff_with request
1158
+ # return 200, 'text/plain', 'you got a page'
1159
+ # end
1160
+ # end
1161
+ #
1162
+ # This servlet can be mounted on a server at a given path:
1163
+ #
1164
+ # server.mount '/simple', Simple
1165
+ #
1166
+ # == Servlet Configuration
1167
+ #
1168
+ # Servlets can be configured via initialize. The first argument is the
1169
+ # HTTP server the servlet is being initialized for.
1170
+ #
1171
+ # class Configurable < Simple
1172
+ # def initialize server, color, size
1173
+ # super server
1174
+ # @color = color
1175
+ # @size = size
1176
+ # end
1177
+ #
1178
+ # def do_stuff_with request
1179
+ # content = "<p " \
1180
+ # %q{style="color: #{@color}; font-size: #{@size}"} \
1181
+ # ">Hello, World!"
1182
+ #
1183
+ # return 200, "text/html", content
1184
+ # end
1185
+ # end
1186
+ #
1187
+ # This servlet must be provided two arguments at mount time:
1188
+ #
1189
+ # server.mount '/configurable', Configurable, 'red', '2em'
1190
+ class WEBrick::HTTPServlet::AbstractServlet
1191
+ # Initializes a new servlet for +server+ using +options+ which are
1192
+ # stored as-is in +@options+. +@logger+ is also provided.
1193
+ #
1194
+ # @return [AbstractServlet] a new instance of AbstractServlet
1195
+ def initialize(server, *options); end
1196
+
1197
+ # Raises a NotFound exception
1198
+ #
1199
+ # @raise [HTTPStatus::NotFound]
1200
+ def do_GET(req, res); end
1201
+
1202
+ # Dispatches to do_GET
1203
+ def do_HEAD(req, res); end
1204
+
1205
+ # Returns the allowed HTTP request methods
1206
+ def do_OPTIONS(req, res); end
1207
+
1208
+ # Dispatches to a +do_+ method based on +req+ if such a method is
1209
+ # available. (+do_GET+ for a GET request). Raises a MethodNotAllowed
1210
+ # exception if the method is not implemented.
1211
+ def service(req, res); end
1212
+
1213
+ private
1214
+
1215
+ # Redirects to a path ending in /
1216
+ def redirect_to_directory_uri(req, res); end
1217
+
1218
+ class << self
1219
+ # Factory for servlet instances that will handle a request from +server+
1220
+ # using +options+ from the mount point. By default a new servlet
1221
+ # instance is created for every call.
1222
+ def get_instance(server, *options); end
1223
+ end
1224
+ end
1225
+
1226
+ # Servlet for handling CGI scripts
1227
+ #
1228
+ # Example:
1229
+ #
1230
+ # server.mount('/cgi/my_script', WEBrick::HTTPServlet::CGIHandler,
1231
+ # '/path/to/my_script')
1232
+ class WEBrick::HTTPServlet::CGIHandler < ::WEBrick::HTTPServlet::AbstractServlet
1233
+ # Creates a new CGI script servlet for the script at +name+
1234
+ #
1235
+ # @return [CGIHandler] a new instance of CGIHandler
1236
+ def initialize(server, name); end
1237
+
1238
+ # :stopdoc:
1239
+ #
1240
+ # @raise [HTTPStatus::InternalServerError]
1241
+ def do_GET(req, res); end
1242
+
1243
+ # :stopdoc:
1244
+ #
1245
+ # @raise [HTTPStatus::InternalServerError]
1246
+ def do_POST(req, res); end
1247
+ end
1248
+
1249
+ WEBrick::HTTPServlet::CGIHandler::CGIRunnerArray = T.let(T.unsafe(nil), Array)
1250
+
1251
+ # Servlet for serving a single file. You probably want to use the
1252
+ # FileHandler servlet instead as it handles directories and fancy indexes.
1253
+ #
1254
+ # Example:
1255
+ #
1256
+ # server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,
1257
+ # '/path/to/my_page.txt')
1258
+ #
1259
+ # This servlet handles If-Modified-Since and Range requests.
1260
+ class WEBrick::HTTPServlet::DefaultFileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1261
+ # Creates a DefaultFileHandler instance for the file at +local_path+.
1262
+ #
1263
+ # @return [DefaultFileHandler] a new instance of DefaultFileHandler
1264
+ def initialize(server, local_path); end
1265
+
1266
+ # :stopdoc:
1267
+ def do_GET(req, res); end
1268
+
1269
+ def make_partial_content(req, res, filename, filesize); end
1270
+
1271
+ # returns a lambda for webrick/httpresponse.rb send_body_proc
1272
+ def multipart_body(body, parts, boundary, mtype, filesize); end
1273
+
1274
+ # @return [Boolean]
1275
+ def not_modified?(req, res, mtime, etag); end
1276
+
1277
+ def prepare_range(range, filesize); end
1278
+ end
1279
+
1280
+ # ERBHandler evaluates an ERB file and returns the result. This handler
1281
+ # is automatically used if there are .rhtml files in a directory served by
1282
+ # the FileHandler.
1283
+ #
1284
+ # ERBHandler supports GET and POST methods.
1285
+ #
1286
+ # The ERB file is evaluated with the local variables +servlet_request+ and
1287
+ # +servlet_response+ which are a WEBrick::HTTPRequest and
1288
+ # WEBrick::HTTPResponse respectively.
1289
+ #
1290
+ # Example .rhtml file:
1291
+ #
1292
+ # Request to <%= servlet_request.request_uri %>
1293
+ #
1294
+ # Query params <%= servlet_request.query.inspect %>
1295
+ class WEBrick::HTTPServlet::ERBHandler < ::WEBrick::HTTPServlet::AbstractServlet
1296
+ # Creates a new ERBHandler on +server+ that will evaluate and serve the
1297
+ # ERB file +name+
1298
+ #
1299
+ # @return [ERBHandler] a new instance of ERBHandler
1300
+ def initialize(server, name); end
1301
+
1302
+ # Handles GET requests
1303
+ def do_GET(req, res); end
1304
+
1305
+ # Handles GET requests
1306
+ #
1307
+ # Handles POST requests
1308
+ def do_POST(req, res); end
1309
+
1310
+ private
1311
+
1312
+ # Evaluates +erb+ providing +servlet_request+ and +servlet_response+ as
1313
+ # local variables.
1314
+ def evaluate(erb, servlet_request, servlet_response); end
1315
+ end
1316
+
1317
+ # Serves a directory including fancy indexing and a variety of other
1318
+ # options.
1319
+ #
1320
+ # Example:
1321
+ #
1322
+ # server.mount('/assets', WEBrick::HTTPServlet::FileHandler,
1323
+ # '/path/to/assets')
1324
+ class WEBrick::HTTPServlet::FileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1325
+ # Creates a FileHandler servlet on +server+ that serves files starting
1326
+ # at directory +root+
1327
+ #
1328
+ # +options+ may be a Hash containing keys from
1329
+ # WEBrick::Config::FileHandler or +true+ or +false+.
1330
+ #
1331
+ # If +options+ is true or false then +:FancyIndexing+ is enabled or
1332
+ # disabled respectively.
1333
+ #
1334
+ # @return [FileHandler] a new instance of FileHandler
1335
+ def initialize(server, root, options = T.unsafe(nil), default = T.unsafe(nil)); end
1336
+
1337
+ def do_GET(req, res); end
1338
+ def do_OPTIONS(req, res); end
1339
+ def do_POST(req, res); end
1340
+ def service(req, res); end
1341
+
1342
+ # :stopdoc:
1343
+ def set_filesystem_encoding(str); end
1344
+
1345
+ private
1346
+
1347
+ def call_callback(callback_name, req, res); end
1348
+ def check_filename(req, res, name); end
1349
+
1350
+ # @raise [HTTPStatus::NotFound]
1351
+ def exec_handler(req, res); end
1352
+
1353
+ def get_handler(req, res); end
1354
+
1355
+ # @return [Boolean]
1356
+ def nondisclosure_name?(name); end
1357
+
1358
+ def prevent_directory_traversal(req, res); end
1359
+ def search_file(req, res, basename); end
1360
+ def search_index_file(req, res); end
1361
+ def set_dir_list(req, res); end
1362
+ def set_filename(req, res); end
1363
+ def shift_path_info(req, res, path_info, base = T.unsafe(nil)); end
1364
+
1365
+ # @return [Boolean]
1366
+ def trailing_pathsep?(path); end
1367
+
1368
+ # @return [Boolean]
1369
+ def windows_ambiguous_name?(name); end
1370
+
1371
+ class << self
1372
+ # Allow custom handling of requests for files with +suffix+ by class
1373
+ # +handler+
1374
+ def add_handler(suffix, handler); end
1375
+
1376
+ # Remove custom handling of requests for files with +suffix+
1377
+ def remove_handler(suffix); end
1378
+ end
1379
+ end
1380
+
1381
+ # This module is used to manager HTTP status codes.
1382
+ #
1383
+ # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more
1384
+ # information.
1385
+ module WEBrick::HTTPStatus
1386
+ private
1387
+
1388
+ # Is +code+ a client error status?
1389
+ #
1390
+ # @return [Boolean]
1391
+ def client_error?(code); end
1392
+
1393
+ # Is +code+ an error status?
1394
+ #
1395
+ # @return [Boolean]
1396
+ def error?(code); end
1397
+
1398
+ # Is +code+ an informational status?
1399
+ #
1400
+ # @return [Boolean]
1401
+ def info?(code); end
1402
+
1403
+ # Returns the description corresponding to the HTTP status +code+
1404
+ #
1405
+ # WEBrick::HTTPStatus.reason_phrase 404
1406
+ # => "Not Found"
1407
+ def reason_phrase(code); end
1408
+
1409
+ # Is +code+ a redirection status?
1410
+ #
1411
+ # @return [Boolean]
1412
+ def redirect?(code); end
1413
+
1414
+ # Is +code+ a server error status?
1415
+ #
1416
+ # @return [Boolean]
1417
+ def server_error?(code); end
1418
+
1419
+ # Is +code+ a successful status?
1420
+ #
1421
+ # @return [Boolean]
1422
+ def success?(code); end
1423
+
1424
+ class << self
1425
+ # Returns the status class corresponding to +code+
1426
+ #
1427
+ # WEBrick::HTTPStatus[302]
1428
+ # => WEBrick::HTTPStatus::NotFound
1429
+ def [](code); end
1430
+
1431
+ # Is +code+ a client error status?
1432
+ #
1433
+ # @return [Boolean]
1434
+ def client_error?(code); end
1435
+
1436
+ # Is +code+ an error status?
1437
+ #
1438
+ # @return [Boolean]
1439
+ def error?(code); end
1440
+
1441
+ # Is +code+ an informational status?
1442
+ #
1443
+ # @return [Boolean]
1444
+ def info?(code); end
1445
+
1446
+ # Returns the description corresponding to the HTTP status +code+
1447
+ #
1448
+ # WEBrick::HTTPStatus.reason_phrase 404
1449
+ # => "Not Found"
1450
+ def reason_phrase(code); end
1451
+
1452
+ # Is +code+ a redirection status?
1453
+ #
1454
+ # @return [Boolean]
1455
+ def redirect?(code); end
1456
+
1457
+ # Is +code+ a server error status?
1458
+ #
1459
+ # @return [Boolean]
1460
+ def server_error?(code); end
1461
+
1462
+ # Is +code+ a successful status?
1463
+ #
1464
+ # @return [Boolean]
1465
+ def success?(code); end
1466
+ end
1467
+ end
1468
+
1469
+ # Root of the HTTP status class hierarchy
1470
+ class WEBrick::HTTPStatus::Status < ::StandardError
1471
+ # Returns the HTTP status code
1472
+ def code; end
1473
+
1474
+ # Returns the HTTP status description
1475
+ def reason_phrase; end
1476
+
1477
+ # Returns the HTTP status code
1478
+ def to_i; end
1479
+
1480
+ class << self
1481
+ def code; end
1482
+ def reason_phrase; end
1483
+ end
1484
+ end
1485
+
1486
+ # HTTPUtils provides utility methods for working with the HTTP protocol.
1487
+ #
1488
+ # This module is generally used internally by WEBrick
1489
+ module WEBrick::HTTPUtils
1490
+ private
1491
+
1492
+ def _escape(str, regex); end
1493
+
1494
+ # :stopdoc:
1495
+ def _make_regex(str); end
1496
+
1497
+ def _make_regex!(str); end
1498
+ def _unescape(str, regex); end
1499
+
1500
+ # Removes quotes and escapes from +str+
1501
+ def dequote(str); end
1502
+
1503
+ # Escapes HTTP reserved and unwise characters in +str+
1504
+ def escape(str); end
1505
+
1506
+ # Escapes 8 bit characters in +str+
1507
+ def escape8bit(str); end
1508
+
1509
+ # Escapes form reserved characters in +str+
1510
+ def escape_form(str); end
1511
+
1512
+ # Escapes path +str+
1513
+ def escape_path(str); end
1514
+
1515
+ # Loads Apache-compatible mime.types in +file+.
1516
+ def load_mime_types(file); end
1517
+
1518
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
1519
+ # mime type was found application/octet-stream is returned.
1520
+ def mime_type(filename, mime_tab); end
1521
+
1522
+ # Normalizes a request path. Raises an exception if the path cannot be
1523
+ # normalized.
1524
+ def normalize_path(path); end
1525
+
1526
+ # Parses form data in +io+ with the given +boundary+
1527
+ def parse_form_data(io, boundary); end
1528
+
1529
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
1530
+ # of values.
1531
+ def parse_header(raw); end
1532
+
1533
+ # Parses the query component of a URI in +str+
1534
+ def parse_query(str); end
1535
+
1536
+ # Parses q values in +value+ as used in Accept headers.
1537
+ def parse_qvalues(value); end
1538
+
1539
+ # Parses a Range header value +ranges_specifier+
1540
+ def parse_range_header(ranges_specifier); end
1541
+
1542
+ # Quotes and escapes quotes in +str+
1543
+ def quote(str); end
1544
+
1545
+ # Splits a header value +str+ according to HTTP specification.
1546
+ def split_header_value(str); end
1547
+
1548
+ # Unescapes HTTP reserved and unwise characters in +str+
1549
+ def unescape(str); end
1550
+
1551
+ # Unescapes form reserved characters in +str+
1552
+ def unescape_form(str); end
1553
+
1554
+ class << self
1555
+ def _escape(str, regex); end
1556
+
1557
+ # :stopdoc:
1558
+ def _make_regex(str); end
1559
+
1560
+ def _make_regex!(str); end
1561
+ def _unescape(str, regex); end
1562
+
1563
+ # Removes quotes and escapes from +str+
1564
+ def dequote(str); end
1565
+
1566
+ # Escapes HTTP reserved and unwise characters in +str+
1567
+ def escape(str); end
1568
+
1569
+ # Escapes 8 bit characters in +str+
1570
+ def escape8bit(str); end
1571
+
1572
+ # Escapes form reserved characters in +str+
1573
+ def escape_form(str); end
1574
+
1575
+ # Escapes path +str+
1576
+ def escape_path(str); end
1577
+
1578
+ # Loads Apache-compatible mime.types in +file+.
1579
+ def load_mime_types(file); end
1580
+
1581
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
1582
+ # mime type was found application/octet-stream is returned.
1583
+ def mime_type(filename, mime_tab); end
1584
+
1585
+ # Normalizes a request path. Raises an exception if the path cannot be
1586
+ # normalized.
1587
+ def normalize_path(path); end
1588
+
1589
+ # Parses form data in +io+ with the given +boundary+
1590
+ def parse_form_data(io, boundary); end
1591
+
1592
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
1593
+ # of values.
1594
+ def parse_header(raw); end
1595
+
1596
+ # Parses the query component of a URI in +str+
1597
+ def parse_query(str); end
1598
+
1599
+ # Parses q values in +value+ as used in Accept headers.
1600
+ def parse_qvalues(value); end
1601
+
1602
+ # Parses a Range header value +ranges_specifier+
1603
+ def parse_range_header(ranges_specifier); end
1604
+
1605
+ # Quotes and escapes quotes in +str+
1606
+ def quote(str); end
1607
+
1608
+ # Splits a header value +str+ according to HTTP specification.
1609
+ def split_header_value(str); end
1610
+
1611
+ # Unescapes HTTP reserved and unwise characters in +str+
1612
+ def unescape(str); end
1613
+
1614
+ # Unescapes form reserved characters in +str+
1615
+ def unescape_form(str); end
1616
+ end
1617
+ end
1618
+
1619
+ # Stores multipart form data. FormData objects are created when
1620
+ # WEBrick::HTTPUtils.parse_form_data is called.
1621
+ class WEBrick::HTTPUtils::FormData < ::String
1622
+ # Creates a new FormData object.
1623
+ #
1624
+ # +args+ is an Array of form data entries. One FormData will be created
1625
+ # for each entry.
1626
+ #
1627
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
1628
+ #
1629
+ # @return [FormData] a new instance of FormData
1630
+ def initialize(*args); end
1631
+
1632
+ # Adds +str+ to this FormData which may be the body, a header or a
1633
+ # header entry.
1634
+ #
1635
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
1636
+ def <<(str); end
1637
+
1638
+ # Retrieves the header at the first entry in +key+
1639
+ def [](*key); end
1640
+
1641
+ # Adds +data+ at the end of the chain of entries
1642
+ #
1643
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you.
1644
+ def append_data(data); end
1645
+
1646
+ # Yields each entry in this FormData
1647
+ def each_data; end
1648
+
1649
+ # The filename of the form data part
1650
+ def filename; end
1651
+
1652
+ # The filename of the form data part
1653
+ def filename=(_arg0); end
1654
+
1655
+ # Returns all the FormData as an Array
1656
+ def list; end
1657
+
1658
+ # The name of the form data part
1659
+ def name; end
1660
+
1661
+ # The name of the form data part
1662
+ def name=(_arg0); end
1663
+
1664
+ def next_data=(_arg0); end
1665
+
1666
+ # Returns all the FormData as an Array
1667
+ #
1668
+ # A FormData will behave like an Array
1669
+ def to_ary; end
1670
+
1671
+ # This FormData's body
1672
+ def to_s; end
1673
+
1674
+ protected
1675
+
1676
+ def next_data; end
1677
+ end
1678
+
1679
+ module WEBrick::Utils
1680
+ private
1681
+
1682
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
1683
+ #
1684
+ # It will create IPV4 and IPV6 sockets on all interfaces.
1685
+ def create_listeners(address, port); end
1686
+
1687
+ # The server hostname
1688
+ def getservername; end
1689
+
1690
+ # Generates a random string of length +len+
1691
+ def random_string(len); end
1692
+
1693
+ # Sets the close on exec flag for +io+
1694
+ def set_close_on_exec(io); end
1695
+
1696
+ # Sets IO operations on +io+ to be non-blocking
1697
+ def set_non_blocking(io); end
1698
+
1699
+ # Changes the process's uid and gid to the ones of +user+
1700
+ def su(user); end
1701
+
1702
+ # Executes the passed block and raises +exception+ if execution takes more
1703
+ # than +seconds+.
1704
+ #
1705
+ # If +seconds+ is zero or nil, simply executes the block
1706
+ def timeout(seconds, exception = T.unsafe(nil)); end
1707
+
1708
+ class << self
1709
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
1710
+ #
1711
+ # It will create IPV4 and IPV6 sockets on all interfaces.
1712
+ def create_listeners(address, port); end
1713
+
1714
+ # The server hostname
1715
+ def getservername; end
1716
+
1717
+ # Generates a random string of length +len+
1718
+ def random_string(len); end
1719
+
1720
+ # Sets the close on exec flag for +io+
1721
+ def set_close_on_exec(io); end
1722
+
1723
+ # Sets IO operations on +io+ to be non-blocking
1724
+ def set_non_blocking(io); end
1725
+
1726
+ # Changes the process's uid and gid to the ones of +user+
1727
+ def su(user); end
1728
+
1729
+ # Executes the passed block and raises +exception+ if execution takes more
1730
+ # than +seconds+.
1731
+ #
1732
+ # If +seconds+ is zero or nil, simply executes the block
1733
+ def timeout(seconds, exception = T.unsafe(nil)); end
1734
+ end
1735
+ end
1736
+
1737
+ # Class used to manage timeout handlers across multiple threads.
1738
+ #
1739
+ # Timeout handlers should be managed by using the class methods which are
1740
+ # synchronized.
1741
+ #
1742
+ # id = TimeoutHandler.register(10, Timeout::Error)
1743
+ # begin
1744
+ # sleep 20
1745
+ # puts 'foo'
1746
+ # ensure
1747
+ # TimeoutHandler.cancel(id)
1748
+ # end
1749
+ #
1750
+ # will raise Timeout::Error
1751
+ #
1752
+ # id = TimeoutHandler.register(10, Timeout::Error)
1753
+ # begin
1754
+ # sleep 5
1755
+ # puts 'foo'
1756
+ # ensure
1757
+ # TimeoutHandler.cancel(id)
1758
+ # end
1759
+ #
1760
+ # will print 'foo'
1761
+ class WEBrick::Utils::TimeoutHandler
1762
+ include ::Singleton
1763
+ extend ::Singleton::SingletonClassMethods
1764
+
1765
+ # Creates a new TimeoutHandler. You should use ::register and ::cancel
1766
+ # instead of creating the timeout handler directly.
1767
+ #
1768
+ # @return [TimeoutHandler] a new instance of TimeoutHandler
1769
+ def initialize; end
1770
+
1771
+ # Cancels the timeout handler +id+
1772
+ def cancel(thread, id); end
1773
+
1774
+ # Interrupts the timeout handler +id+ and raises +exception+
1775
+ def interrupt(thread, id, exception); end
1776
+
1777
+ # Registers a new timeout handler
1778
+ #
1779
+ # +time+:: Timeout in seconds
1780
+ # +exception+:: Exception to raise when timeout elapsed
1781
+ def register(thread, time, exception); end
1782
+
1783
+ def terminate; end
1784
+
1785
+ private
1786
+
1787
+ def watch; end
1788
+ def watcher; end
1789
+
1790
+ class << self
1791
+ # Cancels the timeout handler +id+
1792
+ def cancel(id); end
1793
+
1794
+ # Registers a new timeout handler
1795
+ #
1796
+ # +time+:: Timeout in seconds
1797
+ # +exception+:: Exception to raise when timeout elapsed
1798
+ def register(seconds, exception); end
1799
+
1800
+ def terminate; end
1801
+ end
1802
+ end