rubocop-packs 0.0.7

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