mangrove 0.21.2 → 0.22.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2606 @@
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#566
1134
+ def _read_data(io, method, *arg); end
1135
+
1136
+ # source://webrick//lib/webrick/httprequest.rb#506
1137
+ def parse_host_request_line(host); end
1138
+
1139
+ # source://webrick//lib/webrick/httprequest.rb#586
1140
+ def parse_query; end
1141
+
1142
+ # source://webrick//lib/webrick/httprequest.rb#484
1143
+ def parse_uri(str, scheme = T.unsafe(nil)); end
1144
+
1145
+ # source://webrick//lib/webrick/httprequest.rb#511
1146
+ def read_body(socket, block); end
1147
+
1148
+ # source://webrick//lib/webrick/httprequest.rb#535
1149
+ def read_chunk_size(socket); end
1150
+
1151
+ # source://webrick//lib/webrick/httprequest.rb#546
1152
+ def read_chunked(socket, block); end
1153
+
1154
+ # source://webrick//lib/webrick/httprequest.rb#582
1155
+ def read_data(io, size); end
1156
+
1157
+ # source://webrick//lib/webrick/httprequest.rb#471
1158
+ def read_header(socket); end
1159
+
1160
+ # source://webrick//lib/webrick/httprequest.rb#578
1161
+ def read_line(io, size = T.unsafe(nil)); end
1162
+
1163
+ # @raise [HTTPStatus::EOFError]
1164
+ #
1165
+ # source://webrick//lib/webrick/httprequest.rb#451
1166
+ def read_request_line(socket); end
1167
+
1168
+ # It's said that all X-Forwarded-* headers will contain more than one
1169
+ # (comma-separated) value if the original request already contained one of
1170
+ # these headers. Since we could use these values as Host header, we choose
1171
+ # the initial(first) value. (apr_table_mergen() adds new value after the
1172
+ # existing value with ", " prefix)
1173
+ #
1174
+ # source://webrick//lib/webrick/httprequest.rb#614
1175
+ def setup_forwarded_info; end
1176
+ end
1177
+
1178
+ # same as Mongrel, Thin and Puma
1179
+ #
1180
+ # source://webrick//lib/webrick/httprequest.rb#449
1181
+ WEBrick::HTTPRequest::MAX_HEADER_LENGTH = T.let(T.unsafe(nil), Integer)
1182
+
1183
+ # An HTTP response. This is filled in by the service or do_* methods of a
1184
+ # WEBrick HTTP Servlet.
1185
+ #
1186
+ # source://webrick//lib/webrick/httpresponse.rb#24
1187
+ class WEBrick::HTTPResponse
1188
+ # Creates a new HTTP response object. WEBrick::Config::HTTP is the
1189
+ # default configuration.
1190
+ #
1191
+ # @return [HTTPResponse] a new instance of HTTPResponse
1192
+ #
1193
+ # source://webrick//lib/webrick/httpresponse.rb#117
1194
+ def initialize(config); end
1195
+
1196
+ # Retrieves the response header +field+
1197
+ #
1198
+ # source://webrick//lib/webrick/httpresponse.rb#155
1199
+ def [](field); end
1200
+
1201
+ # Sets the response header +field+ to +value+
1202
+ #
1203
+ # source://webrick//lib/webrick/httpresponse.rb#162
1204
+ def []=(field, value); end
1205
+
1206
+ # Body may be:
1207
+ # * a String;
1208
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
1209
+ # * a Proc-like object that responds to +#call+.
1210
+ #
1211
+ # In the latter case, either #chunked= should be set to +true+,
1212
+ # or <code>header['content-length']</code> explicitly provided.
1213
+ # Example:
1214
+ #
1215
+ # server.mount_proc '/' do |req, res|
1216
+ # res.chunked = true
1217
+ # # or
1218
+ # # res.header['content-length'] = 10
1219
+ # res.body = proc { |out| out.write(Time.now.to_s) }
1220
+ # end
1221
+ #
1222
+ # source://webrick//lib/webrick/httpresponse.rb#70
1223
+ def body; end
1224
+
1225
+ # Body may be:
1226
+ # * a String;
1227
+ # * an IO-like object that responds to +#read+ and +#readpartial+;
1228
+ # * a Proc-like object that responds to +#call+.
1229
+ #
1230
+ # In the latter case, either #chunked= should be set to +true+,
1231
+ # or <code>header['content-length']</code> explicitly provided.
1232
+ # Example:
1233
+ #
1234
+ # server.mount_proc '/' do |req, res|
1235
+ # res.chunked = true
1236
+ # # or
1237
+ # # res.header['content-length'] = 10
1238
+ # res.body = proc { |out| out.write(Time.now.to_s) }
1239
+ # end
1240
+ #
1241
+ # source://webrick//lib/webrick/httpresponse.rb#70
1242
+ def body=(_arg0); end
1243
+
1244
+ # Enables chunked transfer encoding.
1245
+ #
1246
+ # source://webrick//lib/webrick/httpresponse.rb#214
1247
+ def chunked=(val); end
1248
+
1249
+ # Will this response body be returned using chunked transfer-encoding?
1250
+ #
1251
+ # @return [Boolean]
1252
+ #
1253
+ # source://webrick//lib/webrick/httpresponse.rb#207
1254
+ def chunked?; end
1255
+
1256
+ # Configuration for this response
1257
+ #
1258
+ # source://webrick//lib/webrick/httpresponse.rb#101
1259
+ def config; end
1260
+
1261
+ # The content-length header
1262
+ #
1263
+ # source://webrick//lib/webrick/httpresponse.rb#170
1264
+ def content_length; end
1265
+
1266
+ # Sets the content-length header to +len+
1267
+ #
1268
+ # source://webrick//lib/webrick/httpresponse.rb#179
1269
+ def content_length=(len); end
1270
+
1271
+ # The content-type header
1272
+ #
1273
+ # source://webrick//lib/webrick/httpresponse.rb#186
1274
+ def content_type; end
1275
+
1276
+ # Sets the content-type header to +type+
1277
+ #
1278
+ # source://webrick//lib/webrick/httpresponse.rb#193
1279
+ def content_type=(type); end
1280
+
1281
+ # Response cookies
1282
+ #
1283
+ # source://webrick//lib/webrick/httpresponse.rb#46
1284
+ def cookies; end
1285
+
1286
+ # Iterates over each header in the response
1287
+ #
1288
+ # source://webrick//lib/webrick/httpresponse.rb#200
1289
+ def each; end
1290
+
1291
+ # Filename of the static file in this response. Only used by the
1292
+ # FileHandler servlet.
1293
+ #
1294
+ # source://webrick//lib/webrick/httpresponse.rb#91
1295
+ def filename; end
1296
+
1297
+ # Filename of the static file in this response. Only used by the
1298
+ # FileHandler servlet.
1299
+ #
1300
+ # source://webrick//lib/webrick/httpresponse.rb#91
1301
+ def filename=(_arg0); end
1302
+
1303
+ # Response header
1304
+ #
1305
+ # source://webrick//lib/webrick/httpresponse.rb#41
1306
+ def header; end
1307
+
1308
+ # HTTP Response version
1309
+ #
1310
+ # source://webrick//lib/webrick/httpresponse.rb#31
1311
+ def http_version; end
1312
+
1313
+ # Is this a keep-alive response?
1314
+ #
1315
+ # source://webrick//lib/webrick/httpresponse.rb#96
1316
+ def keep_alive; end
1317
+
1318
+ # Is this a keep-alive response?
1319
+ #
1320
+ # source://webrick//lib/webrick/httpresponse.rb#96
1321
+ def keep_alive=(_arg0); end
1322
+
1323
+ # Will this response's connection be kept alive?
1324
+ #
1325
+ # @return [Boolean]
1326
+ #
1327
+ # source://webrick//lib/webrick/httpresponse.rb#221
1328
+ def keep_alive?; end
1329
+
1330
+ # source://webrick//lib/webrick/httpresponse.rb#325
1331
+ def make_body_tempfile; end
1332
+
1333
+ # Response reason phrase ("OK")
1334
+ #
1335
+ # source://webrick//lib/webrick/httpresponse.rb#51
1336
+ def reason_phrase; end
1337
+
1338
+ # Response reason phrase ("OK")
1339
+ #
1340
+ # source://webrick//lib/webrick/httpresponse.rb#51
1341
+ def reason_phrase=(_arg0); end
1342
+
1343
+ # source://webrick//lib/webrick/httpresponse.rb#343
1344
+ def remove_body_tempfile; end
1345
+
1346
+ # Request HTTP version for this response
1347
+ #
1348
+ # source://webrick//lib/webrick/httpresponse.rb#85
1349
+ def request_http_version; end
1350
+
1351
+ # Request HTTP version for this response
1352
+ #
1353
+ # source://webrick//lib/webrick/httpresponse.rb#85
1354
+ def request_http_version=(_arg0); end
1355
+
1356
+ # Request method for this response
1357
+ #
1358
+ # source://webrick//lib/webrick/httpresponse.rb#75
1359
+ def request_method; end
1360
+
1361
+ # Request method for this response
1362
+ #
1363
+ # source://webrick//lib/webrick/httpresponse.rb#75
1364
+ def request_method=(_arg0); end
1365
+
1366
+ # Request URI for this response
1367
+ #
1368
+ # source://webrick//lib/webrick/httpresponse.rb#80
1369
+ def request_uri; end
1370
+
1371
+ # Request URI for this response
1372
+ #
1373
+ # source://webrick//lib/webrick/httpresponse.rb#80
1374
+ def request_uri=(_arg0); end
1375
+
1376
+ # Sends the body on +socket+
1377
+ #
1378
+ # source://webrick//lib/webrick/httpresponse.rb#378
1379
+ def send_body(socket); end
1380
+
1381
+ # Sends the headers on +socket+
1382
+ #
1383
+ # source://webrick//lib/webrick/httpresponse.rb#355
1384
+ def send_header(socket); end
1385
+
1386
+ # Sends the response on +socket+
1387
+ #
1388
+ # source://webrick//lib/webrick/httpresponse.rb#238
1389
+ def send_response(socket); end
1390
+
1391
+ # Bytes sent in this response
1392
+ #
1393
+ # source://webrick//lib/webrick/httpresponse.rb#106
1394
+ def sent_size; end
1395
+
1396
+ # Creates an error page for exception +ex+ with an optional +backtrace+
1397
+ #
1398
+ # source://webrick//lib/webrick/httpresponse.rb#405
1399
+ def set_error(ex, backtrace = T.unsafe(nil)); end
1400
+
1401
+ # Redirects to +url+ with a WEBrick::HTTPStatus::Redirect +status+.
1402
+ #
1403
+ # Example:
1404
+ #
1405
+ # res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
1406
+ #
1407
+ # source://webrick//lib/webrick/httpresponse.rb#395
1408
+ def set_redirect(status, url); end
1409
+
1410
+ # Sets up the headers for sending
1411
+ #
1412
+ # source://webrick//lib/webrick/httpresponse.rb#255
1413
+ def setup_header; end
1414
+
1415
+ # Response status code (200)
1416
+ #
1417
+ # source://webrick//lib/webrick/httpresponse.rb#36
1418
+ def status; end
1419
+
1420
+ # Sets the response's status to the +status+ code
1421
+ #
1422
+ # source://webrick//lib/webrick/httpresponse.rb#147
1423
+ def status=(status); end
1424
+
1425
+ # The response's HTTP status line
1426
+ #
1427
+ # source://webrick//lib/webrick/httpresponse.rb#140
1428
+ def status_line; end
1429
+
1430
+ # Set the response body proc as an streaming/upgrade response.
1431
+ #
1432
+ # source://webrick//lib/webrick/httpresponse.rb#111
1433
+ def upgrade; end
1434
+
1435
+ # Sets the response to be a streaming/upgrade response.
1436
+ # This will disable keep-alive and chunked transfer encoding.
1437
+ #
1438
+ # source://webrick//lib/webrick/httpresponse.rb#229
1439
+ def upgrade!(protocol); end
1440
+
1441
+ # Set the response body proc as an streaming/upgrade response.
1442
+ #
1443
+ # source://webrick//lib/webrick/httpresponse.rb#111
1444
+ def upgrade=(_arg0); end
1445
+
1446
+ private
1447
+
1448
+ # preserved for compatibility with some 3rd-party handlers
1449
+ #
1450
+ # source://webrick//lib/webrick/httpresponse.rb#581
1451
+ def _write_data(socket, data); end
1452
+
1453
+ # source://webrick//lib/webrick/httpresponse.rb#432
1454
+ def check_header(header_value); end
1455
+
1456
+ # :stopdoc:
1457
+ #
1458
+ # source://webrick//lib/webrick/httpresponse.rb#443
1459
+ def error_body(backtrace, ex, host, port); end
1460
+
1461
+ # source://webrick//lib/webrick/httpresponse.rb#473
1462
+ def send_body_io(socket); end
1463
+
1464
+ # source://webrick//lib/webrick/httpresponse.rb#535
1465
+ def send_body_proc(socket); end
1466
+
1467
+ # source://webrick//lib/webrick/httpresponse.rb#513
1468
+ def send_body_string(socket); end
1469
+ end
1470
+
1471
+ # source://webrick//lib/webrick/httpresponse.rb#555
1472
+ class WEBrick::HTTPResponse::ChunkedWrapper
1473
+ # @return [ChunkedWrapper] a new instance of ChunkedWrapper
1474
+ #
1475
+ # source://webrick//lib/webrick/httpresponse.rb#556
1476
+ def initialize(socket, resp); end
1477
+
1478
+ # source://webrick//lib/webrick/httpresponse.rb#574
1479
+ def <<(*buf); end
1480
+
1481
+ # source://webrick//lib/webrick/httpresponse.rb#561
1482
+ def write(buf); end
1483
+ end
1484
+
1485
+ # An HTTP Server
1486
+ #
1487
+ # source://webrick//lib/webrick/httpserver.rb#27
1488
+ class WEBrick::HTTPServer < ::WEBrick::GenericServer
1489
+ # Creates a new HTTP server according to +config+
1490
+ #
1491
+ # An HTTP server uses the following attributes:
1492
+ #
1493
+ # :AccessLog:: An array of access logs. See WEBrick::AccessLog
1494
+ # :BindAddress:: Local address for the server to bind to
1495
+ # :DocumentRoot:: Root path to serve files from
1496
+ # :DocumentRootOptions:: Options for the default HTTPServlet::FileHandler
1497
+ # :HTTPVersion:: The HTTP version of this server
1498
+ # :Port:: Port to listen on
1499
+ # :RequestCallback:: Called with a request and response before each
1500
+ # request is serviced.
1501
+ # :RequestTimeout:: Maximum time to wait between requests
1502
+ # :ServerAlias:: Array of alternate names for this server for virtual
1503
+ # hosting
1504
+ # :ServerName:: Name for this server for virtual hosting
1505
+ #
1506
+ # @return [HTTPServer] a new instance of HTTPServer
1507
+ #
1508
+ # source://webrick//lib/webrick/httpserver.rb#46
1509
+ def initialize(config = T.unsafe(nil), default = T.unsafe(nil)); end
1510
+
1511
+ # Logs +req+ and +res+ in the access logs. +config+ is used for the
1512
+ # server name.
1513
+ #
1514
+ # source://webrick//lib/webrick/httpserver.rb#220
1515
+ def access_log(config, req, res); end
1516
+
1517
+ # Creates the HTTPRequest used when handling the HTTP
1518
+ # request. Can be overridden by subclasses.
1519
+ #
1520
+ # source://webrick//lib/webrick/httpserver.rb#230
1521
+ def create_request(with_webrick_config); end
1522
+
1523
+ # Creates the HTTPResponse used when handling the HTTP
1524
+ # request. Can be overridden by subclasses.
1525
+ #
1526
+ # source://webrick//lib/webrick/httpserver.rb#237
1527
+ def create_response(with_webrick_config); end
1528
+
1529
+ # The default OPTIONS request handler says GET, HEAD, POST and OPTIONS
1530
+ # requests are allowed.
1531
+ #
1532
+ # source://webrick//lib/webrick/httpserver.rb#147
1533
+ def do_OPTIONS(req, res); end
1534
+
1535
+ # Finds the appropriate virtual host to handle +req+
1536
+ #
1537
+ # source://webrick//lib/webrick/httpserver.rb#207
1538
+ def lookup_server(req); end
1539
+
1540
+ # Mounts +servlet+ on +dir+ passing +options+ to the servlet at creation
1541
+ # time
1542
+ #
1543
+ # source://webrick//lib/webrick/httpserver.rb#155
1544
+ def mount(dir, servlet, *options); end
1545
+
1546
+ # Mounts +proc+ or +block+ on +dir+ and calls it with a
1547
+ # WEBrick::HTTPRequest and WEBrick::HTTPResponse
1548
+ #
1549
+ # @raise [HTTPServerError]
1550
+ #
1551
+ # source://webrick//lib/webrick/httpserver.rb#164
1552
+ def mount_proc(dir, proc = T.unsafe(nil), &block); end
1553
+
1554
+ # Processes requests on +sock+
1555
+ #
1556
+ # source://webrick//lib/webrick/httpserver.rb#69
1557
+ def run(sock); end
1558
+
1559
+ # Finds a servlet for +path+
1560
+ #
1561
+ # source://webrick//lib/webrick/httpserver.rb#182
1562
+ def search_servlet(path); end
1563
+
1564
+ # Services +req+ and fills in +res+
1565
+ #
1566
+ # @raise [HTTPStatus::NotFound]
1567
+ #
1568
+ # source://webrick//lib/webrick/httpserver.rb#125
1569
+ def service(req, res); end
1570
+
1571
+ # Unmounts +dir+
1572
+ #
1573
+ # source://webrick//lib/webrick/httpserver.rb#173
1574
+ def umount(dir); end
1575
+
1576
+ # Unmounts +dir+
1577
+ #
1578
+ # source://webrick//lib/webrick/httpserver.rb#173
1579
+ def unmount(dir); end
1580
+
1581
+ # Adds +server+ as a virtual host.
1582
+ #
1583
+ # source://webrick//lib/webrick/httpserver.rb#193
1584
+ def virtual_host(server); end
1585
+ end
1586
+
1587
+ # Mount table for the path a servlet is mounted on in the directory space
1588
+ # of the server. Users of WEBrick can only access this indirectly via
1589
+ # WEBrick::HTTPServer#mount, WEBrick::HTTPServer#unmount and
1590
+ # WEBrick::HTTPServer#search_servlet
1591
+ #
1592
+ # source://webrick//lib/webrick/httpserver.rb#247
1593
+ class WEBrick::HTTPServer::MountTable
1594
+ # @return [MountTable] a new instance of MountTable
1595
+ #
1596
+ # source://webrick//lib/webrick/httpserver.rb#248
1597
+ def initialize; end
1598
+
1599
+ # source://webrick//lib/webrick/httpserver.rb#253
1600
+ def [](dir); end
1601
+
1602
+ # source://webrick//lib/webrick/httpserver.rb#258
1603
+ def []=(dir, val); end
1604
+
1605
+ # source://webrick//lib/webrick/httpserver.rb#265
1606
+ def delete(dir); end
1607
+
1608
+ # source://webrick//lib/webrick/httpserver.rb#272
1609
+ def scan(path); end
1610
+
1611
+ private
1612
+
1613
+ # source://webrick//lib/webrick/httpserver.rb#279
1614
+ def compile; end
1615
+
1616
+ # source://webrick//lib/webrick/httpserver.rb#287
1617
+ def normalize(dir); end
1618
+ end
1619
+
1620
+ # AbstractServlet allows HTTP server modules to be reused across multiple
1621
+ # servers and allows encapsulation of functionality.
1622
+ #
1623
+ # By default a servlet will respond to GET, HEAD (through an alias to GET)
1624
+ # and OPTIONS requests.
1625
+ #
1626
+ # By default a new servlet is initialized for every request. A servlet
1627
+ # instance can be reused by overriding ::get_instance in the
1628
+ # AbstractServlet subclass.
1629
+ #
1630
+ # == A Simple Servlet
1631
+ #
1632
+ # class Simple < WEBrick::HTTPServlet::AbstractServlet
1633
+ # def do_GET request, response
1634
+ # status, content_type, body = do_stuff_with request
1635
+ #
1636
+ # response.status = status
1637
+ # response['Content-Type'] = content_type
1638
+ # response.body = body
1639
+ # end
1640
+ #
1641
+ # def do_stuff_with request
1642
+ # return 200, 'text/plain', 'you got a page'
1643
+ # end
1644
+ # end
1645
+ #
1646
+ # This servlet can be mounted on a server at a given path:
1647
+ #
1648
+ # server.mount '/simple', Simple
1649
+ #
1650
+ # == Servlet Configuration
1651
+ #
1652
+ # Servlets can be configured via initialize. The first argument is the
1653
+ # HTTP server the servlet is being initialized for.
1654
+ #
1655
+ # class Configurable < Simple
1656
+ # def initialize server, color, size
1657
+ # super server
1658
+ # @color = color
1659
+ # @size = size
1660
+ # end
1661
+ #
1662
+ # def do_stuff_with request
1663
+ # content = "<p " \
1664
+ # %q{style="color: #{@color}; font-size: #{@size}"} \
1665
+ # ">Hello, World!"
1666
+ #
1667
+ # return 200, "text/html", content
1668
+ # end
1669
+ # end
1670
+ #
1671
+ # This servlet must be provided two arguments at mount time:
1672
+ #
1673
+ # server.mount '/configurable', Configurable, 'red', '2em'
1674
+ #
1675
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#76
1676
+ class WEBrick::HTTPServlet::AbstractServlet
1677
+ # Initializes a new servlet for +server+ using +options+ which are
1678
+ # stored as-is in +@options+. +@logger+ is also provided.
1679
+ #
1680
+ # @return [AbstractServlet] a new instance of AbstractServlet
1681
+ #
1682
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#91
1683
+ def initialize(server, *options); end
1684
+
1685
+ # Raises a NotFound exception
1686
+ #
1687
+ # @raise [HTTPStatus::NotFound]
1688
+ #
1689
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#115
1690
+ def do_GET(req, res); end
1691
+
1692
+ # Dispatches to do_GET
1693
+ #
1694
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#122
1695
+ def do_HEAD(req, res); end
1696
+
1697
+ # Returns the allowed HTTP request methods
1698
+ #
1699
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#129
1700
+ def do_OPTIONS(req, res); end
1701
+
1702
+ # Dispatches to a +do_+ method based on +req+ if such a method is
1703
+ # available. (+do_GET+ for a GET request). Raises a MethodNotAllowed
1704
+ # exception if the method is not implemented.
1705
+ #
1706
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#102
1707
+ def service(req, res); end
1708
+
1709
+ private
1710
+
1711
+ # Redirects to a path ending in /
1712
+ #
1713
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#140
1714
+ def redirect_to_directory_uri(req, res); end
1715
+
1716
+ class << self
1717
+ # Factory for servlet instances that will handle a request from +server+
1718
+ # using +options+ from the mount point. By default a new servlet
1719
+ # instance is created for every call.
1720
+ #
1721
+ # source://webrick//lib/webrick/httpservlet/abstract.rb#83
1722
+ def get_instance(server, *options); end
1723
+ end
1724
+ end
1725
+
1726
+ # Servlet for handling CGI scripts
1727
+ #
1728
+ # Example:
1729
+ #
1730
+ # server.mount('/cgi/my_script', WEBrick::HTTPServlet::CGIHandler,
1731
+ # '/path/to/my_script')
1732
+ #
1733
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#28
1734
+ class WEBrick::HTTPServlet::CGIHandler < ::WEBrick::HTTPServlet::AbstractServlet
1735
+ # Creates a new CGI script servlet for the script at +name+
1736
+ #
1737
+ # @return [CGIHandler] a new instance of CGIHandler
1738
+ #
1739
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#36
1740
+ def initialize(server, name); end
1741
+
1742
+ # :stopdoc:
1743
+ #
1744
+ # @raise [HTTPStatus::InternalServerError]
1745
+ #
1746
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#50
1747
+ def do_GET(req, res); end
1748
+
1749
+ # :stopdoc:
1750
+ #
1751
+ # @raise [HTTPStatus::InternalServerError]
1752
+ #
1753
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#50
1754
+ def do_POST(req, res); end
1755
+ end
1756
+
1757
+ # source://webrick//lib/webrick/httpservlet/cgihandler.rb#31
1758
+ WEBrick::HTTPServlet::CGIHandler::CGIRunnerArray = T.let(T.unsafe(nil), Array)
1759
+
1760
+ # Servlet for serving a single file. You probably want to use the
1761
+ # FileHandler servlet instead as it handles directories and fancy indexes.
1762
+ #
1763
+ # Example:
1764
+ #
1765
+ # server.mount('/my_page.txt', WEBrick::HTTPServlet::DefaultFileHandler,
1766
+ # '/path/to/my_page.txt')
1767
+ #
1768
+ # This servlet handles If-Modified-Since and Range requests.
1769
+ #
1770
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#32
1771
+ class WEBrick::HTTPServlet::DefaultFileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1772
+ # Creates a DefaultFileHandler instance for the file at +local_path+.
1773
+ #
1774
+ # @return [DefaultFileHandler] a new instance of DefaultFileHandler
1775
+ #
1776
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#37
1777
+ def initialize(server, local_path); end
1778
+
1779
+ # :stopdoc:
1780
+ #
1781
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#44
1782
+ def do_GET(req, res); end
1783
+
1784
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#118
1785
+ def make_partial_content(req, res, filename, filesize); end
1786
+
1787
+ # returns a lambda for webrick/httpresponse.rb send_body_proc
1788
+ #
1789
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#90
1790
+ def multipart_body(body, parts, boundary, mtype, filesize); end
1791
+
1792
+ # @return [Boolean]
1793
+ #
1794
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#64
1795
+ def not_modified?(req, res, mtime, etag); end
1796
+
1797
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#155
1798
+ def prepare_range(range, filesize); end
1799
+ end
1800
+
1801
+ # ERBHandler evaluates an ERB file and returns the result. This handler
1802
+ # is automatically used if there are .rhtml files in a directory served by
1803
+ # the FileHandler.
1804
+ #
1805
+ # ERBHandler supports GET and POST methods.
1806
+ #
1807
+ # The ERB file is evaluated with the local variables +servlet_request+ and
1808
+ # +servlet_response+ which are a WEBrick::HTTPRequest and
1809
+ # WEBrick::HTTPResponse respectively.
1810
+ #
1811
+ # Example .rhtml file:
1812
+ #
1813
+ # Request to <%= servlet_request.request_uri %>
1814
+ #
1815
+ # Query params <%= servlet_request.query.inspect %>
1816
+ #
1817
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#36
1818
+ class WEBrick::HTTPServlet::ERBHandler < ::WEBrick::HTTPServlet::AbstractServlet
1819
+ # Creates a new ERBHandler on +server+ that will evaluate and serve the
1820
+ # ERB file +name+
1821
+ #
1822
+ # @return [ERBHandler] a new instance of ERBHandler
1823
+ #
1824
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#42
1825
+ def initialize(server, name); end
1826
+
1827
+ # Handles GET requests
1828
+ #
1829
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#50
1830
+ def do_GET(req, res); end
1831
+
1832
+ # Handles GET requests
1833
+ #
1834
+ # Handles POST requests
1835
+ #
1836
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#50
1837
+ def do_POST(req, res); end
1838
+
1839
+ private
1840
+
1841
+ # Evaluates +erb+ providing +servlet_request+ and +servlet_response+ as
1842
+ # local variables.
1843
+ #
1844
+ # source://webrick//lib/webrick/httpservlet/erbhandler.rb#79
1845
+ def evaluate(erb, servlet_request, servlet_response); end
1846
+ end
1847
+
1848
+ # Serves a directory including fancy indexing and a variety of other
1849
+ # options.
1850
+ #
1851
+ # Example:
1852
+ #
1853
+ # server.mount('/assets', WEBrick::HTTPServlet::FileHandler,
1854
+ # '/path/to/assets')
1855
+ #
1856
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#175
1857
+ class WEBrick::HTTPServlet::FileHandler < ::WEBrick::HTTPServlet::AbstractServlet
1858
+ # Creates a FileHandler servlet on +server+ that serves files starting
1859
+ # at directory +root+
1860
+ #
1861
+ # +options+ may be a Hash containing keys from
1862
+ # WEBrick::Config::FileHandler or +true+ or +false+.
1863
+ #
1864
+ # If +options+ is true or false then +:FancyIndexing+ is enabled or
1865
+ # disabled respectively.
1866
+ #
1867
+ # @return [FileHandler] a new instance of FileHandler
1868
+ #
1869
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#203
1870
+ def initialize(server, root, options = T.unsafe(nil), default = T.unsafe(nil)); end
1871
+
1872
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#245
1873
+ def do_GET(req, res); end
1874
+
1875
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#257
1876
+ def do_OPTIONS(req, res); end
1877
+
1878
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#251
1879
+ def do_POST(req, res); end
1880
+
1881
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#224
1882
+ def service(req, res); end
1883
+
1884
+ # :stopdoc:
1885
+ #
1886
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#215
1887
+ def set_filesystem_encoding(str); end
1888
+
1889
+ private
1890
+
1891
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#416
1892
+ def call_callback(callback_name, req, res); end
1893
+
1894
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#369
1895
+ def check_filename(req, res, name); end
1896
+
1897
+ # @raise [HTTPStatus::NotFound]
1898
+ #
1899
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#309
1900
+ def exec_handler(req, res); end
1901
+
1902
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#322
1903
+ def get_handler(req, res); end
1904
+
1905
+ # @return [Boolean]
1906
+ #
1907
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#428
1908
+ def nondisclosure_name?(name); end
1909
+
1910
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#286
1911
+ def prevent_directory_traversal(req, res); end
1912
+
1913
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#394
1914
+ def search_file(req, res, basename); end
1915
+
1916
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#385
1917
+ def search_index_file(req, res); end
1918
+
1919
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#437
1920
+ def set_dir_list(req, res); end
1921
+
1922
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#335
1923
+ def set_filename(req, res); end
1924
+
1925
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#376
1926
+ def shift_path_info(req, res, path_info, base = T.unsafe(nil)); end
1927
+
1928
+ # @return [Boolean]
1929
+ #
1930
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#277
1931
+ def trailing_pathsep?(path); end
1932
+
1933
+ # @return [Boolean]
1934
+ #
1935
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#422
1936
+ def windows_ambiguous_name?(name); end
1937
+
1938
+ class << self
1939
+ # Allow custom handling of requests for files with +suffix+ by class
1940
+ # +handler+
1941
+ #
1942
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#182
1943
+ def add_handler(suffix, handler); end
1944
+
1945
+ # Remove custom handling of requests for files with +suffix+
1946
+ #
1947
+ # source://webrick//lib/webrick/httpservlet/filehandler.rb#189
1948
+ def remove_handler(suffix); end
1949
+ end
1950
+ end
1951
+
1952
+ # Mounts a proc at a path that accepts a request and response.
1953
+ #
1954
+ # Instead of mounting this servlet with WEBrick::HTTPServer#mount use
1955
+ # WEBrick::HTTPServer#mount_proc:
1956
+ #
1957
+ # server.mount_proc '/' do |req, res|
1958
+ # res.body = 'it worked!'
1959
+ # res.status = 200
1960
+ # end
1961
+ #
1962
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#28
1963
+ class WEBrick::HTTPServlet::ProcHandler < ::WEBrick::HTTPServlet::AbstractServlet
1964
+ # @return [ProcHandler] a new instance of ProcHandler
1965
+ #
1966
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#34
1967
+ def initialize(proc); end
1968
+
1969
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#38
1970
+ def do_GET(request, response); end
1971
+
1972
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#38
1973
+ def do_POST(request, response); end
1974
+
1975
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#38
1976
+ def do_PUT(request, response); end
1977
+
1978
+ # :stopdoc:
1979
+ #
1980
+ # source://webrick//lib/webrick/httpservlet/prochandler.rb#30
1981
+ def get_instance(server, *options); end
1982
+ end
1983
+
1984
+ # This module is used to manager HTTP status codes.
1985
+ #
1986
+ # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more
1987
+ # information.
1988
+ #
1989
+ # source://webrick//lib/webrick/httpstatus.rb#21
1990
+ module WEBrick::HTTPStatus
1991
+ private
1992
+
1993
+ # Is +code+ a client error status?
1994
+ #
1995
+ # @return [Boolean]
1996
+ #
1997
+ # source://webrick//lib/webrick/httpstatus.rb#170
1998
+ def client_error?(code); end
1999
+
2000
+ # Is +code+ an error status?
2001
+ #
2002
+ # @return [Boolean]
2003
+ #
2004
+ # source://webrick//lib/webrick/httpstatus.rb#164
2005
+ def error?(code); end
2006
+
2007
+ # Is +code+ an informational status?
2008
+ #
2009
+ # @return [Boolean]
2010
+ #
2011
+ # source://webrick//lib/webrick/httpstatus.rb#146
2012
+ def info?(code); end
2013
+
2014
+ # Returns the description corresponding to the HTTP status +code+
2015
+ #
2016
+ # WEBrick::HTTPStatus.reason_phrase 404
2017
+ # => "Not Found"
2018
+ #
2019
+ # source://webrick//lib/webrick/httpstatus.rb#140
2020
+ def reason_phrase(code); end
2021
+
2022
+ # Is +code+ a redirection status?
2023
+ #
2024
+ # @return [Boolean]
2025
+ #
2026
+ # source://webrick//lib/webrick/httpstatus.rb#158
2027
+ def redirect?(code); end
2028
+
2029
+ # Is +code+ a server error status?
2030
+ #
2031
+ # @return [Boolean]
2032
+ #
2033
+ # source://webrick//lib/webrick/httpstatus.rb#176
2034
+ def server_error?(code); end
2035
+
2036
+ # Is +code+ a successful status?
2037
+ #
2038
+ # @return [Boolean]
2039
+ #
2040
+ # source://webrick//lib/webrick/httpstatus.rb#152
2041
+ def success?(code); end
2042
+
2043
+ class << self
2044
+ # Returns the status class corresponding to +code+
2045
+ #
2046
+ # WEBrick::HTTPStatus[302]
2047
+ # => WEBrick::HTTPStatus::NotFound
2048
+ #
2049
+ # source://webrick//lib/webrick/httpstatus.rb#186
2050
+ def [](code); end
2051
+
2052
+ # Is +code+ a client error status?
2053
+ #
2054
+ # @return [Boolean]
2055
+ #
2056
+ # source://webrick//lib/webrick/httpstatus.rb#170
2057
+ def client_error?(code); end
2058
+
2059
+ # Is +code+ an error status?
2060
+ #
2061
+ # @return [Boolean]
2062
+ #
2063
+ # source://webrick//lib/webrick/httpstatus.rb#164
2064
+ def error?(code); end
2065
+
2066
+ # Is +code+ an informational status?
2067
+ #
2068
+ # @return [Boolean]
2069
+ #
2070
+ # source://webrick//lib/webrick/httpstatus.rb#146
2071
+ def info?(code); end
2072
+
2073
+ # Returns the description corresponding to the HTTP status +code+
2074
+ #
2075
+ # WEBrick::HTTPStatus.reason_phrase 404
2076
+ # => "Not Found"
2077
+ #
2078
+ # source://webrick//lib/webrick/httpstatus.rb#140
2079
+ def reason_phrase(code); end
2080
+
2081
+ # Is +code+ a redirection status?
2082
+ #
2083
+ # @return [Boolean]
2084
+ #
2085
+ # source://webrick//lib/webrick/httpstatus.rb#158
2086
+ def redirect?(code); end
2087
+
2088
+ # Is +code+ a server error status?
2089
+ #
2090
+ # @return [Boolean]
2091
+ #
2092
+ # source://webrick//lib/webrick/httpstatus.rb#176
2093
+ def server_error?(code); end
2094
+
2095
+ # Is +code+ a successful status?
2096
+ #
2097
+ # @return [Boolean]
2098
+ #
2099
+ # source://webrick//lib/webrick/httpstatus.rb#152
2100
+ def success?(code); end
2101
+ end
2102
+ end
2103
+
2104
+ # Root of the HTTP status class hierarchy
2105
+ #
2106
+ # source://webrick//lib/webrick/httpstatus.rb#25
2107
+ class WEBrick::HTTPStatus::Status < ::StandardError
2108
+ # Returns the HTTP status code
2109
+ #
2110
+ # source://webrick//lib/webrick/httpstatus.rb#31
2111
+ def code; end
2112
+
2113
+ # Returns the HTTP status description
2114
+ #
2115
+ # source://webrick//lib/webrick/httpstatus.rb#34
2116
+ def reason_phrase; end
2117
+
2118
+ # Returns the HTTP status code
2119
+ #
2120
+ # source://webrick//lib/webrick/httpstatus.rb#31
2121
+ def to_i; end
2122
+
2123
+ class << self
2124
+ # source://webrick//lib/webrick/httpstatus.rb#27
2125
+ def code; end
2126
+
2127
+ # source://webrick//lib/webrick/httpstatus.rb#27
2128
+ def reason_phrase; end
2129
+ end
2130
+ end
2131
+
2132
+ # HTTPUtils provides utility methods for working with the HTTP protocol.
2133
+ #
2134
+ # This module is generally used internally by WEBrick
2135
+ #
2136
+ # source://webrick//lib/webrick/httputils.rb#25
2137
+ module WEBrick::HTTPUtils
2138
+ private
2139
+
2140
+ # source://webrick//lib/webrick/httputils.rb#454
2141
+ def _escape(str, regex); end
2142
+
2143
+ # :stopdoc:
2144
+ #
2145
+ # source://webrick//lib/webrick/httputils.rb#452
2146
+ def _make_regex(str); end
2147
+
2148
+ # source://webrick//lib/webrick/httputils.rb#453
2149
+ def _make_regex!(str); end
2150
+
2151
+ # source://webrick//lib/webrick/httputils.rb#460
2152
+ def _unescape(str, regex); end
2153
+
2154
+ # Removes quotes and escapes from +str+
2155
+ #
2156
+ # source://webrick//lib/webrick/httputils.rb#234
2157
+ def dequote(str); end
2158
+
2159
+ # Escapes HTTP reserved and unwise characters in +str+
2160
+ #
2161
+ # source://webrick//lib/webrick/httputils.rb#478
2162
+ def escape(str); end
2163
+
2164
+ # Escapes 8 bit characters in +str+
2165
+ #
2166
+ # source://webrick//lib/webrick/httputils.rb#519
2167
+ def escape8bit(str); end
2168
+
2169
+ # Escapes form reserved characters in +str+
2170
+ #
2171
+ # source://webrick//lib/webrick/httputils.rb#492
2172
+ def escape_form(str); end
2173
+
2174
+ # Escapes path +str+
2175
+ #
2176
+ # source://webrick//lib/webrick/httputils.rb#508
2177
+ def escape_path(str); end
2178
+
2179
+ # Loads Apache-compatible mime.types in +file+.
2180
+ #
2181
+ # source://webrick//lib/webrick/httputils.rb#123
2182
+ def load_mime_types(file); end
2183
+
2184
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
2185
+ # mime type was found application/octet-stream is returned.
2186
+ #
2187
+ # source://webrick//lib/webrick/httputils.rb#145
2188
+ def mime_type(filename, mime_tab); end
2189
+
2190
+ # Normalizes a request path. Raises an exception if the path cannot be
2191
+ # normalized.
2192
+ #
2193
+ # source://webrick//lib/webrick/httputils.rb#31
2194
+ def normalize_path(path); end
2195
+
2196
+ # Parses form data in +io+ with the given +boundary+
2197
+ #
2198
+ # source://webrick//lib/webrick/httputils.rb#406
2199
+ def parse_form_data(io, boundary); end
2200
+
2201
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
2202
+ # of values.
2203
+ #
2204
+ # source://webrick//lib/webrick/httputils.rb#156
2205
+ def parse_header(raw); end
2206
+
2207
+ # Parses the query component of a URI in +str+
2208
+ #
2209
+ # source://webrick//lib/webrick/httputils.rb#382
2210
+ def parse_query(str); end
2211
+
2212
+ # Parses q values in +value+ as used in Accept headers.
2213
+ #
2214
+ # source://webrick//lib/webrick/httputils.rb#213
2215
+ def parse_qvalues(value); end
2216
+
2217
+ # Parses a Range header value +ranges_specifier+
2218
+ #
2219
+ # source://webrick//lib/webrick/httputils.rb#195
2220
+ def parse_range_header(ranges_specifier); end
2221
+
2222
+ # Quotes and escapes quotes in +str+
2223
+ #
2224
+ # source://webrick//lib/webrick/httputils.rb#244
2225
+ def quote(str); end
2226
+
2227
+ # Splits a header value +str+ according to HTTP specification.
2228
+ #
2229
+ # source://webrick//lib/webrick/httputils.rb#186
2230
+ def split_header_value(str); end
2231
+
2232
+ # Unescapes HTTP reserved and unwise characters in +str+
2233
+ #
2234
+ # source://webrick//lib/webrick/httputils.rb#485
2235
+ def unescape(str); end
2236
+
2237
+ # Unescapes form reserved characters in +str+
2238
+ #
2239
+ # source://webrick//lib/webrick/httputils.rb#501
2240
+ def unescape_form(str); end
2241
+
2242
+ class << self
2243
+ # source://webrick//lib/webrick/httputils.rb#454
2244
+ def _escape(str, regex); end
2245
+
2246
+ # :stopdoc:
2247
+ #
2248
+ # source://webrick//lib/webrick/httputils.rb#452
2249
+ def _make_regex(str); end
2250
+
2251
+ # source://webrick//lib/webrick/httputils.rb#453
2252
+ def _make_regex!(str); end
2253
+
2254
+ # source://webrick//lib/webrick/httputils.rb#460
2255
+ def _unescape(str, regex); end
2256
+
2257
+ # Removes quotes and escapes from +str+
2258
+ #
2259
+ # source://webrick//lib/webrick/httputils.rb#234
2260
+ def dequote(str); end
2261
+
2262
+ # Escapes HTTP reserved and unwise characters in +str+
2263
+ #
2264
+ # source://webrick//lib/webrick/httputils.rb#478
2265
+ def escape(str); end
2266
+
2267
+ # Escapes 8 bit characters in +str+
2268
+ #
2269
+ # source://webrick//lib/webrick/httputils.rb#519
2270
+ def escape8bit(str); end
2271
+
2272
+ # Escapes form reserved characters in +str+
2273
+ #
2274
+ # source://webrick//lib/webrick/httputils.rb#492
2275
+ def escape_form(str); end
2276
+
2277
+ # Escapes path +str+
2278
+ #
2279
+ # source://webrick//lib/webrick/httputils.rb#508
2280
+ def escape_path(str); end
2281
+
2282
+ # Loads Apache-compatible mime.types in +file+.
2283
+ #
2284
+ # source://webrick//lib/webrick/httputils.rb#123
2285
+ def load_mime_types(file); end
2286
+
2287
+ # Returns the mime type of +filename+ from the list in +mime_tab+. If no
2288
+ # mime type was found application/octet-stream is returned.
2289
+ #
2290
+ # source://webrick//lib/webrick/httputils.rb#145
2291
+ def mime_type(filename, mime_tab); end
2292
+
2293
+ # Normalizes a request path. Raises an exception if the path cannot be
2294
+ # normalized.
2295
+ #
2296
+ # source://webrick//lib/webrick/httputils.rb#31
2297
+ def normalize_path(path); end
2298
+
2299
+ # Parses form data in +io+ with the given +boundary+
2300
+ #
2301
+ # source://webrick//lib/webrick/httputils.rb#406
2302
+ def parse_form_data(io, boundary); end
2303
+
2304
+ # Parses an HTTP header +raw+ into a hash of header fields with an Array
2305
+ # of values.
2306
+ #
2307
+ # source://webrick//lib/webrick/httputils.rb#156
2308
+ def parse_header(raw); end
2309
+
2310
+ # Parses the query component of a URI in +str+
2311
+ #
2312
+ # source://webrick//lib/webrick/httputils.rb#382
2313
+ def parse_query(str); end
2314
+
2315
+ # Parses q values in +value+ as used in Accept headers.
2316
+ #
2317
+ # source://webrick//lib/webrick/httputils.rb#213
2318
+ def parse_qvalues(value); end
2319
+
2320
+ # Parses a Range header value +ranges_specifier+
2321
+ #
2322
+ # source://webrick//lib/webrick/httputils.rb#195
2323
+ def parse_range_header(ranges_specifier); end
2324
+
2325
+ # Quotes and escapes quotes in +str+
2326
+ #
2327
+ # source://webrick//lib/webrick/httputils.rb#244
2328
+ def quote(str); end
2329
+
2330
+ # Splits a header value +str+ according to HTTP specification.
2331
+ #
2332
+ # source://webrick//lib/webrick/httputils.rb#186
2333
+ def split_header_value(str); end
2334
+
2335
+ # Unescapes HTTP reserved and unwise characters in +str+
2336
+ #
2337
+ # source://webrick//lib/webrick/httputils.rb#485
2338
+ def unescape(str); end
2339
+
2340
+ # Unescapes form reserved characters in +str+
2341
+ #
2342
+ # source://webrick//lib/webrick/httputils.rb#501
2343
+ def unescape_form(str); end
2344
+ end
2345
+ end
2346
+
2347
+ # Stores multipart form data. FormData objects are created when
2348
+ # WEBrick::HTTPUtils.parse_form_data is called.
2349
+ #
2350
+ # source://webrick//lib/webrick/httputils.rb#253
2351
+ class WEBrick::HTTPUtils::FormData < ::String
2352
+ # Creates a new FormData object.
2353
+ #
2354
+ # +args+ is an Array of form data entries. One FormData will be created
2355
+ # for each entry.
2356
+ #
2357
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
2358
+ #
2359
+ # @return [FormData] a new instance of FormData
2360
+ #
2361
+ # source://webrick//lib/webrick/httputils.rb#278
2362
+ def initialize(*args); end
2363
+
2364
+ # Adds +str+ to this FormData which may be the body, a header or a
2365
+ # header entry.
2366
+ #
2367
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you
2368
+ #
2369
+ # source://webrick//lib/webrick/httputils.rb#311
2370
+ def <<(str); end
2371
+
2372
+ # Retrieves the header at the first entry in +key+
2373
+ #
2374
+ # source://webrick//lib/webrick/httputils.rb#297
2375
+ def [](*key); end
2376
+
2377
+ # Adds +data+ at the end of the chain of entries
2378
+ #
2379
+ # This is called by WEBrick::HTTPUtils.parse_form_data for you.
2380
+ #
2381
+ # source://webrick//lib/webrick/httputils.rb#331
2382
+ def append_data(data); end
2383
+
2384
+ # Yields each entry in this FormData
2385
+ #
2386
+ # source://webrick//lib/webrick/httputils.rb#346
2387
+ def each_data; end
2388
+
2389
+ # The filename of the form data part
2390
+ #
2391
+ # source://webrick//lib/webrick/httputils.rb#265
2392
+ def filename; end
2393
+
2394
+ # The filename of the form data part
2395
+ #
2396
+ # source://webrick//lib/webrick/httputils.rb#265
2397
+ def filename=(_arg0); end
2398
+
2399
+ # Returns all the FormData as an Array
2400
+ #
2401
+ # source://webrick//lib/webrick/httputils.rb#358
2402
+ def list; end
2403
+
2404
+ # The name of the form data part
2405
+ #
2406
+ # source://webrick//lib/webrick/httputils.rb#260
2407
+ def name; end
2408
+
2409
+ # The name of the form data part
2410
+ #
2411
+ # source://webrick//lib/webrick/httputils.rb#260
2412
+ def name=(_arg0); end
2413
+
2414
+ # source://webrick//lib/webrick/httputils.rb#267
2415
+ def next_data=(_arg0); end
2416
+
2417
+ # Returns all the FormData as an Array
2418
+ #
2419
+ # A FormData will behave like an Array
2420
+ #
2421
+ # source://webrick//lib/webrick/httputils.rb#358
2422
+ def to_ary; end
2423
+
2424
+ # This FormData's body
2425
+ #
2426
+ # source://webrick//lib/webrick/httputils.rb#374
2427
+ def to_s; end
2428
+
2429
+ protected
2430
+
2431
+ # source://webrick//lib/webrick/httputils.rb#267
2432
+ def next_data; end
2433
+ end
2434
+
2435
+ # source://webrick//lib/webrick/utils.rb#17
2436
+ module WEBrick::Utils
2437
+ private
2438
+
2439
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
2440
+ #
2441
+ # It will create IPV4 and IPV6 sockets on all interfaces.
2442
+ #
2443
+ # source://webrick//lib/webrick/utils.rb#56
2444
+ def create_listeners(address, port); end
2445
+
2446
+ # The server hostname
2447
+ #
2448
+ # source://webrick//lib/webrick/utils.rb#47
2449
+ def getservername; end
2450
+
2451
+ # Generates a random string of length +len+
2452
+ #
2453
+ # source://webrick//lib/webrick/utils.rb#79
2454
+ def random_string(len); end
2455
+
2456
+ # Sets the close on exec flag for +io+
2457
+ #
2458
+ # source://webrick//lib/webrick/utils.rb#27
2459
+ def set_close_on_exec(io); end
2460
+
2461
+ # Sets IO operations on +io+ to be non-blocking
2462
+ #
2463
+ # source://webrick//lib/webrick/utils.rb#20
2464
+ def set_non_blocking(io); end
2465
+
2466
+ # Changes the process's uid and gid to the ones of +user+
2467
+ #
2468
+ # source://webrick//lib/webrick/utils.rb#34
2469
+ def su(user); end
2470
+
2471
+ # Executes the passed block and raises +exception+ if execution takes more
2472
+ # than +seconds+.
2473
+ #
2474
+ # If +seconds+ is zero or nil, simply executes the block
2475
+ #
2476
+ # source://webrick//lib/webrick/utils.rb#253
2477
+ def timeout(seconds, exception = T.unsafe(nil)); end
2478
+
2479
+ class << self
2480
+ # Creates TCP server sockets bound to +address+:+port+ and returns them.
2481
+ #
2482
+ # It will create IPV4 and IPV6 sockets on all interfaces.
2483
+ #
2484
+ # source://webrick//lib/webrick/utils.rb#56
2485
+ def create_listeners(address, port); end
2486
+
2487
+ # The server hostname
2488
+ #
2489
+ # source://webrick//lib/webrick/utils.rb#47
2490
+ def getservername; end
2491
+
2492
+ # Generates a random string of length +len+
2493
+ #
2494
+ # source://webrick//lib/webrick/utils.rb#79
2495
+ def random_string(len); end
2496
+
2497
+ # Sets the close on exec flag for +io+
2498
+ #
2499
+ # source://webrick//lib/webrick/utils.rb#27
2500
+ def set_close_on_exec(io); end
2501
+
2502
+ # Sets IO operations on +io+ to be non-blocking
2503
+ #
2504
+ # source://webrick//lib/webrick/utils.rb#20
2505
+ def set_non_blocking(io); end
2506
+
2507
+ # Changes the process's uid and gid to the ones of +user+
2508
+ #
2509
+ # source://webrick//lib/webrick/utils.rb#34
2510
+ def su(user); end
2511
+
2512
+ # Executes the passed block and raises +exception+ if execution takes more
2513
+ # than +seconds+.
2514
+ #
2515
+ # If +seconds+ is zero or nil, simply executes the block
2516
+ #
2517
+ # source://webrick//lib/webrick/utils.rb#253
2518
+ def timeout(seconds, exception = T.unsafe(nil)); end
2519
+ end
2520
+ end
2521
+
2522
+ # Class used to manage timeout handlers across multiple threads.
2523
+ #
2524
+ # Timeout handlers should be managed by using the class methods which are
2525
+ # synchronized.
2526
+ #
2527
+ # id = TimeoutHandler.register(10, Timeout::Error)
2528
+ # begin
2529
+ # sleep 20
2530
+ # puts 'foo'
2531
+ # ensure
2532
+ # TimeoutHandler.cancel(id)
2533
+ # end
2534
+ #
2535
+ # will raise Timeout::Error
2536
+ #
2537
+ # id = TimeoutHandler.register(10, Timeout::Error)
2538
+ # begin
2539
+ # sleep 5
2540
+ # puts 'foo'
2541
+ # ensure
2542
+ # TimeoutHandler.cancel(id)
2543
+ # end
2544
+ #
2545
+ # will print 'foo'
2546
+ #
2547
+ # source://webrick//lib/webrick/utils.rb#118
2548
+ class WEBrick::Utils::TimeoutHandler
2549
+ include ::Singleton
2550
+ extend ::Singleton::SingletonClassMethods
2551
+
2552
+ # Creates a new TimeoutHandler. You should use ::register and ::cancel
2553
+ # instead of creating the timeout handler directly.
2554
+ #
2555
+ # @return [TimeoutHandler] a new instance of TimeoutHandler
2556
+ #
2557
+ # source://webrick//lib/webrick/utils.rb#148
2558
+ def initialize; end
2559
+
2560
+ # Cancels the timeout handler +id+
2561
+ #
2562
+ # source://webrick//lib/webrick/utils.rb#226
2563
+ def cancel(thread, id); end
2564
+
2565
+ # Interrupts the timeout handler +id+ and raises +exception+
2566
+ #
2567
+ # source://webrick//lib/webrick/utils.rb#203
2568
+ def interrupt(thread, id, exception); end
2569
+
2570
+ # Registers a new timeout handler
2571
+ #
2572
+ # +time+:: Timeout in seconds
2573
+ # +exception+:: Exception to raise when timeout elapsed
2574
+ #
2575
+ # source://webrick//lib/webrick/utils.rb#214
2576
+ def register(thread, time, exception); end
2577
+
2578
+ # source://webrick//lib/webrick/utils.rb#240
2579
+ def terminate; end
2580
+
2581
+ private
2582
+
2583
+ # source://webrick//lib/webrick/utils.rb#158
2584
+ def watch; end
2585
+
2586
+ # source://webrick//lib/webrick/utils.rb#193
2587
+ def watcher; end
2588
+
2589
+ class << self
2590
+ # Cancels the timeout handler +id+
2591
+ #
2592
+ # source://webrick//lib/webrick/utils.rb#137
2593
+ def cancel(id); end
2594
+
2595
+ # Registers a new timeout handler
2596
+ #
2597
+ # +time+:: Timeout in seconds
2598
+ # +exception+:: Exception to raise when timeout elapsed
2599
+ #
2600
+ # source://webrick//lib/webrick/utils.rb#130
2601
+ def register(seconds, exception); end
2602
+
2603
+ # source://webrick//lib/webrick/utils.rb#141
2604
+ def terminate; end
2605
+ end
2606
+ end