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