anansi 0.0.0

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