shopify-cli 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  3. data/.travis.yml +1 -0
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +39 -7
  6. data/Rakefile +2 -0
  7. data/dev.yml +2 -2
  8. data/docs/_config.yml +1 -18
  9. data/docs/app/node/commands/index.md +2 -80
  10. data/docs/app/node/index.md +2 -33
  11. data/docs/app/rails/commands/index.md +2 -78
  12. data/docs/app/rails/index.md +2 -34
  13. data/docs/core/index.md +2 -84
  14. data/docs/getting-started/index.md +2 -25
  15. data/docs/getting-started/install/index.md +1 -118
  16. data/docs/getting-started/migrate/index.md +2 -94
  17. data/docs/getting-started/uninstall/index.md +2 -35
  18. data/docs/getting-started/upgrade/index.md +2 -39
  19. data/docs/help/start-app/index.md +2 -4
  20. data/docs/index.md +2 -24
  21. data/install.sh +1 -1
  22. data/lib/project_types/extension/cli.rb +19 -10
  23. data/lib/project_types/extension/commands/extension_command.rb +2 -2
  24. data/lib/project_types/extension/features/argo.rb +117 -0
  25. data/lib/project_types/extension/forms/create.rb +2 -2
  26. data/lib/project_types/extension/models/specification.rb +35 -0
  27. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
  28. data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
  29. data/lib/project_types/extension/models/specifications.rb +77 -0
  30. data/lib/project_types/extension/tasks/configure_features.rb +52 -0
  31. data/lib/project_types/extension/tasks/fetch_specifications.rb +38 -0
  32. data/lib/project_types/node/commands/create.rb +3 -1
  33. data/lib/project_types/node/commands/generate.rb +2 -11
  34. data/lib/project_types/node/messages/messages.rb +9 -44
  35. data/lib/project_types/rails/commands/create.rb +8 -9
  36. data/lib/project_types/rails/forms/create.rb +1 -1
  37. data/lib/project_types/rails/gem.rb +1 -1
  38. data/lib/project_types/rails/messages/messages.rb +1 -1
  39. data/lib/project_types/script/cli.rb +7 -4
  40. data/lib/project_types/script/commands/create.rb +6 -4
  41. data/lib/project_types/script/commands/push.rb +5 -13
  42. data/lib/project_types/script/config/extension_points.yml +9 -5
  43. data/lib/project_types/script/errors.rb +17 -0
  44. data/lib/project_types/script/forms/create.rb +26 -2
  45. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +10 -1
  46. data/lib/project_types/script/layers/application/build_script.rb +9 -4
  47. data/lib/project_types/script/layers/application/create_script.rb +12 -10
  48. data/lib/project_types/script/layers/application/extension_points.rb +24 -0
  49. data/lib/project_types/script/layers/application/push_script.rb +18 -16
  50. data/lib/project_types/script/layers/domain/errors.rb +4 -0
  51. data/lib/project_types/script/layers/domain/extension_point.rb +62 -6
  52. data/lib/project_types/script/layers/domain/metadata.rb +55 -0
  53. data/lib/project_types/script/layers/domain/push_package.rb +25 -6
  54. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +6 -6
  55. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +16 -6
  56. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +10 -4
  57. data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
  58. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +25 -13
  59. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
  60. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
  61. data/lib/project_types/script/layers/infrastructure/script_service.rb +7 -1
  62. data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
  63. data/lib/project_types/script/messages/messages.rb +39 -8
  64. data/lib/project_types/script/script_project.rb +25 -16
  65. data/lib/project_types/script/ui/error_handler.rb +34 -1
  66. data/lib/project_types/theme/cli.rb +40 -0
  67. data/lib/project_types/theme/commands/connect.rb +54 -0
  68. data/lib/project_types/theme/commands/create.rb +48 -0
  69. data/lib/project_types/theme/commands/deploy.rb +38 -0
  70. data/lib/project_types/theme/commands/generate.rb +20 -0
  71. data/lib/project_types/theme/commands/generate/env.rb +79 -0
  72. data/lib/project_types/theme/commands/push.rb +55 -0
  73. data/lib/project_types/theme/commands/serve.rb +31 -0
  74. data/lib/project_types/theme/forms/connect.rb +34 -0
  75. data/lib/project_types/theme/forms/create.rb +22 -0
  76. data/lib/project_types/theme/messages/messages.rb +147 -0
  77. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
  78. data/lib/project_types/theme/themekit.rb +113 -0
  79. data/lib/shopify-cli/admin_api.rb +42 -2
  80. data/lib/shopify-cli/api.rb +27 -24
  81. data/lib/shopify-cli/commands/system.rb +1 -1
  82. data/lib/shopify-cli/context.rb +23 -2
  83. data/lib/shopify-cli/feature.rb +0 -2
  84. data/lib/shopify-cli/http_request.rb +20 -8
  85. data/lib/shopify-cli/messages/messages.rb +6 -3
  86. data/lib/shopify-cli/method_object.rb +104 -0
  87. data/lib/shopify-cli/partners_api.rb +8 -2
  88. data/lib/shopify-cli/project_type.rb +1 -1
  89. data/lib/shopify-cli/resolve_constant.rb +25 -0
  90. data/lib/shopify-cli/result.rb +432 -0
  91. data/lib/shopify-cli/shopifolk.rb +3 -2
  92. data/lib/shopify-cli/tasks/select_org_and_shop.rb +6 -5
  93. data/lib/shopify-cli/tunnel.rb +7 -1
  94. data/lib/shopify-cli/version.rb +1 -1
  95. data/lib/shopify_cli.rb +4 -1
  96. data/shopify.fish +1 -1
  97. data/shopify.sh +1 -1
  98. data/vendor/deps/cli-kit/REVISION +1 -1
  99. data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
  100. data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
  101. data/vendor/deps/cli-ui/REVISION +1 -1
  102. data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
  103. data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
  104. data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
  105. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
  106. data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
  107. data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
  108. data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
  109. data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
  110. data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
  111. data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
  112. data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
  113. data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
  114. data/vendor/deps/webrick/.gitignore +9 -0
  115. data/vendor/deps/webrick/Gemfile +3 -0
  116. data/vendor/deps/webrick/LICENSE.txt +22 -0
  117. data/vendor/deps/webrick/README.md +61 -0
  118. data/vendor/deps/webrick/Rakefile +10 -0
  119. data/vendor/deps/webrick/lib/webrick.rb +232 -0
  120. data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
  121. data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
  122. data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
  123. data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
  124. data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
  125. data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
  126. data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
  127. data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
  128. data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
  129. data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
  130. data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
  131. data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
  132. data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
  133. data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
  134. data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
  135. data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
  136. data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
  137. data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
  138. data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
  139. data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
  140. data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
  141. data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
  142. data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
  143. data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
  144. data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
  145. data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
  146. data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
  147. data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
  148. data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
  149. data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
  150. data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
  151. data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
  152. data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
  153. data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
  154. data/vendor/deps/webrick/webrick.gemspec +74 -0
  155. metadata +70 -26
  156. data/docs/Gemfile +0 -5
  157. data/docs/Gemfile.lock +0 -258
  158. data/docs/_data/nav.yml +0 -35
  159. data/docs/_includes/footer.html +0 -15
  160. data/docs/_includes/head.html +0 -19
  161. data/docs/_includes/sidebar_nav.html +0 -22
  162. data/docs/_includes/toc.html +0 -112
  163. data/docs/_layouts/default.html +0 -79
  164. data/docs/css/docs.css +0 -157
  165. data/docs/images/header.png +0 -0
  166. data/docs/installing-ruby.md +0 -28
  167. data/lib/project_types/extension/features/argo/admin.rb +0 -20
  168. data/lib/project_types/extension/features/argo/base.rb +0 -129
  169. data/lib/project_types/extension/features/argo/checkout.rb +0 -20
  170. data/lib/project_types/extension/models/type.rb +0 -81
  171. data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
  172. data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
  173. data/lib/project_types/node/commands/generate/billing.rb +0 -39
  174. data/lib/project_types/node/commands/generate/page.rb +0 -59
  175. data/lib/project_types/node/commands/generate/webhook.rb +0 -37
  176. data/lib/project_types/script/layers/domain/script.rb +0 -18
  177. data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -47
  178. data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
  179. data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
@@ -0,0 +1,313 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # cgi.rb -- Yet another CGI library
4
+ #
5
+ # Author: IPR -- Internet Programming with Ruby -- writers
6
+ # Copyright (c) 2003 Internet Programming with Ruby writers. All rights
7
+ # reserved.
8
+ #
9
+ # $Id$
10
+
11
+ require_relative "httprequest"
12
+ require_relative "httpresponse"
13
+ require_relative "config"
14
+ require "stringio"
15
+
16
+ module WEBrick
17
+
18
+ # A CGI library using WEBrick requests and responses.
19
+ #
20
+ # Example:
21
+ #
22
+ # class MyCGI < WEBrick::CGI
23
+ # def do_GET req, res
24
+ # res.body = 'it worked!'
25
+ # res.status = 200
26
+ # end
27
+ # end
28
+ #
29
+ # MyCGI.new.start
30
+
31
+ class CGI
32
+
33
+ # The CGI error exception class
34
+
35
+ CGIError = Class.new(StandardError)
36
+
37
+ ##
38
+ # The CGI configuration. This is based on WEBrick::Config::HTTP
39
+
40
+ attr_reader :config
41
+
42
+ ##
43
+ # The CGI logger
44
+
45
+ attr_reader :logger
46
+
47
+ ##
48
+ # Creates a new CGI interface.
49
+ #
50
+ # The first argument in +args+ is a configuration hash which would update
51
+ # WEBrick::Config::HTTP.
52
+ #
53
+ # Any remaining arguments are stored in the <code>@options</code> instance
54
+ # variable for use by a subclass.
55
+
56
+ def initialize(*args)
57
+ if defined?(MOD_RUBY)
58
+ unless ENV.has_key?("GATEWAY_INTERFACE")
59
+ Apache.request.setup_cgi_env
60
+ end
61
+ end
62
+ if %r{HTTP/(\d+\.\d+)} =~ ENV["SERVER_PROTOCOL"]
63
+ httpv = $1
64
+ end
65
+ @config = WEBrick::Config::HTTP.dup.update(
66
+ :ServerSoftware => ENV["SERVER_SOFTWARE"] || "null",
67
+ :HTTPVersion => HTTPVersion.new(httpv || "1.0"),
68
+ :RunOnCGI => true, # to detect if it runs on CGI.
69
+ :NPH => false # set true to run as NPH script.
70
+ )
71
+ if config = args.shift
72
+ @config.update(config)
73
+ end
74
+ @config[:Logger] ||= WEBrick::BasicLog.new($stderr)
75
+ @logger = @config[:Logger]
76
+ @options = args
77
+ end
78
+
79
+ ##
80
+ # Reads +key+ from the configuration
81
+
82
+ def [](key)
83
+ @config[key]
84
+ end
85
+
86
+ ##
87
+ # Starts the CGI process with the given environment +env+ and standard
88
+ # input and output +stdin+ and +stdout+.
89
+
90
+ def start(env=ENV, stdin=$stdin, stdout=$stdout)
91
+ sock = WEBrick::CGI::Socket.new(@config, env, stdin, stdout)
92
+ req = HTTPRequest.new(@config)
93
+ res = HTTPResponse.new(@config)
94
+ unless @config[:NPH] or defined?(MOD_RUBY)
95
+ def res.setup_header
96
+ unless @header["status"]
97
+ phrase = HTTPStatus::reason_phrase(@status)
98
+ @header["status"] = "#{@status} #{phrase}"
99
+ end
100
+ super
101
+ end
102
+ def res.status_line
103
+ ""
104
+ end
105
+ end
106
+
107
+ begin
108
+ req.parse(sock)
109
+ req.script_name = (env["SCRIPT_NAME"] || File.expand_path($0)).dup
110
+ req.path_info = (env["PATH_INFO"] || "").dup
111
+ req.query_string = env["QUERY_STRING"]
112
+ req.user = env["REMOTE_USER"]
113
+ res.request_method = req.request_method
114
+ res.request_uri = req.request_uri
115
+ res.request_http_version = req.http_version
116
+ res.keep_alive = req.keep_alive?
117
+ self.service(req, res)
118
+ rescue HTTPStatus::Error => ex
119
+ res.set_error(ex)
120
+ rescue HTTPStatus::Status => ex
121
+ res.status = ex.code
122
+ rescue Exception => ex
123
+ @logger.error(ex)
124
+ res.set_error(ex, true)
125
+ ensure
126
+ req.fixup
127
+ if defined?(MOD_RUBY)
128
+ res.setup_header
129
+ Apache.request.status_line = "#{res.status} #{res.reason_phrase}"
130
+ Apache.request.status = res.status
131
+ table = Apache.request.headers_out
132
+ res.header.each{|key, val|
133
+ case key
134
+ when /^content-encoding$/i
135
+ Apache::request.content_encoding = val
136
+ when /^content-type$/i
137
+ Apache::request.content_type = val
138
+ else
139
+ table[key] = val.to_s
140
+ end
141
+ }
142
+ res.cookies.each{|cookie|
143
+ table.add("Set-Cookie", cookie.to_s)
144
+ }
145
+ Apache.request.send_http_header
146
+ res.send_body(sock)
147
+ else
148
+ res.send_response(sock)
149
+ end
150
+ end
151
+ end
152
+
153
+ ##
154
+ # Services the request +req+ which will fill in the response +res+. See
155
+ # WEBrick::HTTPServlet::AbstractServlet#service for details.
156
+
157
+ def service(req, res)
158
+ method_name = "do_" + req.request_method.gsub(/-/, "_")
159
+ if respond_to?(method_name)
160
+ __send__(method_name, req, res)
161
+ else
162
+ raise HTTPStatus::MethodNotAllowed,
163
+ "unsupported method `#{req.request_method}'."
164
+ end
165
+ end
166
+
167
+ ##
168
+ # Provides HTTP socket emulation from the CGI environment
169
+
170
+ class Socket # :nodoc:
171
+ include Enumerable
172
+
173
+ private
174
+
175
+ def initialize(config, env, stdin, stdout)
176
+ @config = config
177
+ @env = env
178
+ @header_part = StringIO.new
179
+ @body_part = stdin
180
+ @out_port = stdout
181
+ @out_port.binmode
182
+
183
+ @server_addr = @env["SERVER_ADDR"] || "0.0.0.0"
184
+ @server_name = @env["SERVER_NAME"]
185
+ @server_port = @env["SERVER_PORT"]
186
+ @remote_addr = @env["REMOTE_ADDR"]
187
+ @remote_host = @env["REMOTE_HOST"] || @remote_addr
188
+ @remote_port = @env["REMOTE_PORT"] || 0
189
+
190
+ begin
191
+ @header_part << request_line << CRLF
192
+ setup_header
193
+ @header_part << CRLF
194
+ @header_part.rewind
195
+ rescue Exception
196
+ raise CGIError, "invalid CGI environment"
197
+ end
198
+ end
199
+
200
+ def request_line
201
+ meth = @env["REQUEST_METHOD"] || "GET"
202
+ unless url = @env["REQUEST_URI"]
203
+ url = (@env["SCRIPT_NAME"] || File.expand_path($0)).dup
204
+ url << @env["PATH_INFO"].to_s
205
+ url = WEBrick::HTTPUtils.escape_path(url)
206
+ if query_string = @env["QUERY_STRING"]
207
+ unless query_string.empty?
208
+ url << "?" << query_string
209
+ end
210
+ end
211
+ end
212
+ # we cannot get real HTTP version of client ;)
213
+ httpv = @config[:HTTPVersion]
214
+ return "#{meth} #{url} HTTP/#{httpv}"
215
+ end
216
+
217
+ def setup_header
218
+ @env.each{|key, value|
219
+ case key
220
+ when "CONTENT_TYPE", "CONTENT_LENGTH"
221
+ add_header(key.gsub(/_/, "-"), value)
222
+ when /^HTTP_(.*)/
223
+ add_header($1.gsub(/_/, "-"), value)
224
+ end
225
+ }
226
+ end
227
+
228
+ def add_header(hdrname, value)
229
+ unless value.empty?
230
+ @header_part << hdrname << ": " << value << CRLF
231
+ end
232
+ end
233
+
234
+ def input
235
+ @header_part.eof? ? @body_part : @header_part
236
+ end
237
+
238
+ public
239
+
240
+ def peeraddr
241
+ [nil, @remote_port, @remote_host, @remote_addr]
242
+ end
243
+
244
+ def addr
245
+ [nil, @server_port, @server_name, @server_addr]
246
+ end
247
+
248
+ def gets(eol=LF, size=nil)
249
+ input.gets(eol, size)
250
+ end
251
+
252
+ def read(size=nil)
253
+ input.read(size)
254
+ end
255
+
256
+ def each
257
+ input.each{|line| yield(line) }
258
+ end
259
+
260
+ def eof?
261
+ input.eof?
262
+ end
263
+
264
+ def <<(data)
265
+ @out_port << data
266
+ end
267
+
268
+ def write(data)
269
+ @out_port.write(data)
270
+ end
271
+
272
+ def cert
273
+ return nil unless defined?(OpenSSL)
274
+ if pem = @env["SSL_SERVER_CERT"]
275
+ OpenSSL::X509::Certificate.new(pem) unless pem.empty?
276
+ end
277
+ end
278
+
279
+ def peer_cert
280
+ return nil unless defined?(OpenSSL)
281
+ if pem = @env["SSL_CLIENT_CERT"]
282
+ OpenSSL::X509::Certificate.new(pem) unless pem.empty?
283
+ end
284
+ end
285
+
286
+ def peer_cert_chain
287
+ return nil unless defined?(OpenSSL)
288
+ if @env["SSL_CLIENT_CERT_CHAIN_0"]
289
+ keys = @env.keys
290
+ certs = keys.sort.collect{|k|
291
+ if /^SSL_CLIENT_CERT_CHAIN_\d+$/ =~ k
292
+ if pem = @env[k]
293
+ OpenSSL::X509::Certificate.new(pem) unless pem.empty?
294
+ end
295
+ end
296
+ }
297
+ certs.compact
298
+ end
299
+ end
300
+
301
+ def cipher
302
+ return nil unless defined?(OpenSSL)
303
+ if cipher = @env["SSL_CIPHER"]
304
+ ret = [ cipher ]
305
+ ret << @env["SSL_PROTOCOL"]
306
+ ret << @env["SSL_CIPHER_USEKEYSIZE"]
307
+ ret << @env["SSL_CIPHER_ALGKEYSIZE"]
308
+ ret
309
+ end
310
+ end
311
+ end
312
+ end
313
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # compat.rb -- cross platform compatibility
4
+ #
5
+ # Author: IPR -- Internet Programming with Ruby -- writers
6
+ # Copyright (c) 2002 GOTOU Yuuzou
7
+ # Copyright (c) 2002 Internet Programming with Ruby writers. All rights
8
+ # reserved.
9
+ #
10
+ # $IPR: compat.rb,v 1.6 2002/10/01 17:16:32 gotoyuzo Exp $
11
+
12
+ ##
13
+ # System call error module used by webrick for cross platform compatibility.
14
+ #
15
+ # EPROTO:: protocol error
16
+ # ECONNRESET:: remote host reset the connection request
17
+ # ECONNABORTED:: Client sent TCP reset (RST) before server has accepted the
18
+ # connection requested by client.
19
+ #
20
+ module Errno
21
+ ##
22
+ # Protocol error.
23
+
24
+ class EPROTO < SystemCallError; end
25
+
26
+ ##
27
+ # Remote host reset the connection request.
28
+
29
+ class ECONNRESET < SystemCallError; end
30
+
31
+ ##
32
+ # Client sent TCP reset (RST) before server has accepted the connection
33
+ # requested by client.
34
+
35
+ class ECONNABORTED < SystemCallError; end
36
+ end
@@ -0,0 +1,158 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # config.rb -- Default configurations.
4
+ #
5
+ # Author: IPR -- Internet Programming with Ruby -- writers
6
+ # Copyright (c) 2000, 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou
7
+ # Copyright (c) 2003 Internet Programming with Ruby writers. All rights
8
+ # reserved.
9
+ #
10
+ # $IPR: config.rb,v 1.52 2003/07/22 19:20:42 gotoyuzo Exp $
11
+
12
+ require_relative 'version'
13
+ require_relative 'httpversion'
14
+ require_relative 'httputils'
15
+ require_relative 'utils'
16
+ require_relative 'log'
17
+
18
+ module WEBrick
19
+ module Config
20
+ LIBDIR = File::dirname(__FILE__) # :nodoc:
21
+
22
+ # for GenericServer
23
+ General = Hash.new { |hash, key|
24
+ case key
25
+ when :ServerName
26
+ hash[key] = Utils.getservername
27
+ else
28
+ nil
29
+ end
30
+ }.update(
31
+ :BindAddress => nil, # "0.0.0.0" or "::" or nil
32
+ :Port => nil, # users MUST specify this!!
33
+ :MaxClients => 100, # maximum number of the concurrent connections
34
+ :ServerType => nil, # default: WEBrick::SimpleServer
35
+ :Logger => nil, # default: WEBrick::Log.new
36
+ :ServerSoftware => "WEBrick/#{WEBrick::VERSION} " +
37
+ "(Ruby/#{RUBY_VERSION}/#{RUBY_RELEASE_DATE})",
38
+ :TempDir => ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp',
39
+ :DoNotListen => false,
40
+ :StartCallback => nil,
41
+ :StopCallback => nil,
42
+ :AcceptCallback => nil,
43
+ :DoNotReverseLookup => true,
44
+ :ShutdownSocketWithoutClose => false,
45
+ )
46
+
47
+ # for HTTPServer, HTTPRequest, HTTPResponse ...
48
+ HTTP = General.dup.update(
49
+ :Port => 80,
50
+ :RequestTimeout => 30,
51
+ :HTTPVersion => HTTPVersion.new("1.1"),
52
+ :AccessLog => nil,
53
+ :MimeTypes => HTTPUtils::DefaultMimeTypes,
54
+ :DirectoryIndex => ["index.html","index.htm","index.cgi","index.rhtml"],
55
+ :DocumentRoot => nil,
56
+ :DocumentRootOptions => { :FancyIndexing => true },
57
+ :RequestCallback => nil,
58
+ :ServerAlias => nil,
59
+ :InputBufferSize => 65536, # input buffer size in reading request body
60
+ :OutputBufferSize => 65536, # output buffer size in sending File or IO
61
+
62
+ # for HTTPProxyServer
63
+ :ProxyAuthProc => nil,
64
+ :ProxyContentHandler => nil,
65
+ :ProxyVia => true,
66
+ :ProxyTimeout => true,
67
+ :ProxyURI => nil,
68
+
69
+ :CGIInterpreter => nil,
70
+ :CGIPathEnv => nil,
71
+
72
+ # workaround: if Request-URIs contain 8bit chars,
73
+ # they should be escaped before calling of URI::parse().
74
+ :Escape8bitURI => false
75
+ )
76
+
77
+ ##
78
+ # Default configuration for WEBrick::HTTPServlet::FileHandler
79
+ #
80
+ # :AcceptableLanguages::
81
+ # Array of languages allowed for accept-language. There is no default
82
+ # :DirectoryCallback::
83
+ # Allows preprocessing of directory requests. There is no default
84
+ # callback.
85
+ # :FancyIndexing::
86
+ # If true, show an index for directories. The default is true.
87
+ # :FileCallback::
88
+ # Allows preprocessing of file requests. There is no default callback.
89
+ # :HandlerCallback::
90
+ # Allows preprocessing of requests. There is no default callback.
91
+ # :HandlerTable::
92
+ # Maps file suffixes to file handlers. DefaultFileHandler is used by
93
+ # default but any servlet can be used.
94
+ # :NondisclosureName::
95
+ # Do not show files matching this array of globs. .ht* and *~ are
96
+ # excluded by default.
97
+ # :UserDir::
98
+ # Directory inside ~user to serve content from for /~user requests.
99
+ # Only works if mounted on /. Disabled by default.
100
+
101
+ FileHandler = {
102
+ :NondisclosureName => [".ht*", "*~"],
103
+ :FancyIndexing => false,
104
+ :HandlerTable => {},
105
+ :HandlerCallback => nil,
106
+ :DirectoryCallback => nil,
107
+ :FileCallback => nil,
108
+ :UserDir => nil, # e.g. "public_html"
109
+ :AcceptableLanguages => [] # ["en", "ja", ... ]
110
+ }
111
+
112
+ ##
113
+ # Default configuration for WEBrick::HTTPAuth::BasicAuth
114
+ #
115
+ # :AutoReloadUserDB:: Reload the user database provided by :UserDB
116
+ # automatically?
117
+
118
+ BasicAuth = {
119
+ :AutoReloadUserDB => true,
120
+ }
121
+
122
+ ##
123
+ # Default configuration for WEBrick::HTTPAuth::DigestAuth.
124
+ #
125
+ # :Algorithm:: MD5, MD5-sess (default), SHA1, SHA1-sess
126
+ # :Domain:: An Array of URIs that define the protected space
127
+ # :Qop:: 'auth' for authentication, 'auth-int' for integrity protection or
128
+ # both
129
+ # :UseOpaque:: Should the server send opaque values to the client? This
130
+ # helps prevent replay attacks.
131
+ # :CheckNc:: Should the server check the nonce count? This helps the
132
+ # server detect replay attacks.
133
+ # :UseAuthenticationInfoHeader:: Should the server send an
134
+ # AuthenticationInfo header?
135
+ # :AutoReloadUserDB:: Reload the user database provided by :UserDB
136
+ # automatically?
137
+ # :NonceExpirePeriod:: How long should we store used nonces? Default is
138
+ # 30 minutes.
139
+ # :NonceExpireDelta:: How long is a nonce valid? Default is 1 minute
140
+ # :InternetExplorerHack:: Hack which allows Internet Explorer to work.
141
+ # :OperaHack:: Hack which allows Opera to work.
142
+
143
+ DigestAuth = {
144
+ :Algorithm => 'MD5-sess', # or 'MD5'
145
+ :Domain => nil, # an array includes domain names.
146
+ :Qop => [ 'auth' ], # 'auth' or 'auth-int' or both.
147
+ :UseOpaque => true,
148
+ :UseNextNonce => false,
149
+ :CheckNc => false,
150
+ :UseAuthenticationInfoHeader => true,
151
+ :AutoReloadUserDB => true,
152
+ :NonceExpirePeriod => 30*60,
153
+ :NonceExpireDelta => 60,
154
+ :InternetExplorerHack => true,
155
+ :OperaHack => true,
156
+ }
157
+ end
158
+ end