twirbet 0.1.0 → 0.1.1

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