tickrb 0.1.0

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