packwerk 2.2.0 → 2.2.2

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