paperback 0.0.3 → 0.0.5

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