webrick 1.8.1 → 1.9.1
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.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/README.md +2 -0
- data/Rakefile +0 -7
- data/lib/webrick/cgi.rb +1 -1
- data/lib/webrick/httpauth/authenticator.rb +4 -4
- data/lib/webrick/httpauth/htgroup.rb +1 -1
- data/lib/webrick/httpauth/htpasswd.rb +2 -2
- data/lib/webrick/httpproxy.rb +4 -4
- data/lib/webrick/httprequest.rb +42 -14
- data/lib/webrick/httpresponse.rb +1 -1
- data/lib/webrick/httpserver.rb +2 -2
- data/lib/webrick/httpservlet/abstract.rb +1 -1
- data/lib/webrick/httpservlet/filehandler.rb +6 -6
- data/lib/webrick/httputils.rb +34 -14
- data/lib/webrick/server.rb +1 -1
- data/lib/webrick/version.rb +1 -1
- data/sig/accesslog.rbs +24 -0
- data/sig/cgi.rbs +92 -0
- data/sig/compat.rbs +18 -0
- data/sig/config.rbs +17 -0
- data/sig/cookie.rbs +37 -0
- data/sig/htmlutils.rbs +5 -0
- data/sig/httpauth/authenticator.rbs +55 -0
- data/sig/httpauth/basicauth.rbs +29 -0
- data/sig/httpauth/digestauth.rbs +85 -0
- data/sig/httpauth/htdigest.rbs +31 -0
- data/sig/httpauth/htgroup.rbs +21 -0
- data/sig/httpauth/htpasswd.rbs +31 -0
- data/sig/httpauth/userdb.rbs +13 -0
- data/sig/httpauth.rbs +13 -0
- data/sig/httpproxy.rbs +61 -0
- data/sig/httprequest.rbs +167 -0
- data/sig/httpresponse.rbs +117 -0
- data/sig/https.rbs +49 -0
- data/sig/httpserver.rbs +71 -0
- data/sig/httpservlet/abstract.rbs +36 -0
- data/sig/httpservlet/cgi_runner.rbs +3 -0
- data/sig/httpservlet/cgihandler.rbs +23 -0
- data/sig/httpservlet/erbhandler.rbs +17 -0
- data/sig/httpservlet/filehandler.rbs +76 -0
- data/sig/httpservlet/prochandler.rbs +21 -0
- data/sig/httpservlet.rbs +4 -0
- data/sig/httpstatus.rbs +255 -0
- data/sig/httputils.rbs +116 -0
- data/sig/httpversion.rbs +17 -0
- data/sig/log.rbs +93 -0
- data/sig/manifest.yaml +8 -0
- data/sig/server.rbs +57 -0
- data/sig/ssl.rbs +19 -0
- data/sig/utils.rbs +122 -0
- data/sig/version.rbs +3 -0
- data/webrick.gemspec +35 -0
- metadata +43 -8
data/sig/log.rbs
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class BasicLog
|
3
|
+
@log: IO?
|
4
|
+
|
5
|
+
@opened: TrueClass?
|
6
|
+
|
7
|
+
FATAL: 1
|
8
|
+
|
9
|
+
ERROR: 2
|
10
|
+
|
11
|
+
WARN: 3
|
12
|
+
|
13
|
+
INFO: 4
|
14
|
+
|
15
|
+
DEBUG: 5
|
16
|
+
|
17
|
+
# log-level, messages above this level will be logged
|
18
|
+
attr_accessor level: Integer
|
19
|
+
|
20
|
+
type log_file = (IO | String)?
|
21
|
+
|
22
|
+
def initialize: (?log_file log_file, ?Integer? level) -> void
|
23
|
+
|
24
|
+
#
|
25
|
+
# Closes the logger (also closes the log device associated to the logger)
|
26
|
+
def close: () -> void
|
27
|
+
|
28
|
+
def log: (Integer level, String data) -> IO?
|
29
|
+
|
30
|
+
#
|
31
|
+
# Synonym for log(INFO, obj.to_s)
|
32
|
+
def <<: (_ToS obj) -> IO?
|
33
|
+
|
34
|
+
type message = Exception | _ToStr | Object
|
35
|
+
|
36
|
+
# Shortcut for logging a FATAL message
|
37
|
+
def fatal: (message msg) -> IO?
|
38
|
+
|
39
|
+
# Shortcut for logging an ERROR message
|
40
|
+
def error: (message msg) -> IO?
|
41
|
+
|
42
|
+
# Shortcut for logging a WARN message
|
43
|
+
def warn: (message msg) -> IO?
|
44
|
+
|
45
|
+
# Shortcut for logging an INFO message
|
46
|
+
def info: (message msg) -> IO?
|
47
|
+
|
48
|
+
# Shortcut for logging a DEBUG message
|
49
|
+
def debug: (message msg) -> IO?
|
50
|
+
|
51
|
+
# Will the logger output FATAL messages?
|
52
|
+
def fatal?: () -> bool
|
53
|
+
|
54
|
+
# Will the logger output ERROR messages?
|
55
|
+
def error?: () -> bool
|
56
|
+
|
57
|
+
# Will the logger output WARN messages?
|
58
|
+
def warn?: () -> bool
|
59
|
+
|
60
|
+
# Will the logger output INFO messages?
|
61
|
+
def info?: () -> bool
|
62
|
+
|
63
|
+
# Will the logger output DEBUG messages?
|
64
|
+
def debug?: () -> bool
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
#
|
69
|
+
# Formats +arg+ for the logger
|
70
|
+
#
|
71
|
+
# * If +arg+ is an Exception, it will format the error message and
|
72
|
+
# the back trace.
|
73
|
+
# * If +arg+ responds to #to_str, it will return it.
|
74
|
+
# * Otherwise it will return +arg+.inspect.
|
75
|
+
def format: (message arg) -> String
|
76
|
+
end
|
77
|
+
|
78
|
+
class Log < BasicLog
|
79
|
+
# Format of the timestamp which is applied to each logged line. The
|
80
|
+
# default is <tt>"[%Y-%m-%d %H:%M:%S]"</tt>
|
81
|
+
attr_accessor time_format: String
|
82
|
+
|
83
|
+
#
|
84
|
+
# Same as BasicLog#initialize
|
85
|
+
#
|
86
|
+
# You can set the timestamp format through #time_format
|
87
|
+
def initialize: (?BasicLog::log_file log_file, ?Integer? level) -> void
|
88
|
+
|
89
|
+
#
|
90
|
+
# Same as BasicLog#log
|
91
|
+
def log: (Integer level, String data) -> IO?
|
92
|
+
end
|
93
|
+
end
|
data/sig/manifest.yaml
ADDED
data/sig/server.rbs
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class ServerError < StandardError
|
3
|
+
end
|
4
|
+
|
5
|
+
class SimpleServer
|
6
|
+
def self.start: [T] () { () -> T } -> T
|
7
|
+
end
|
8
|
+
|
9
|
+
class Daemon
|
10
|
+
def self.start: () -> void
|
11
|
+
| [T] () { () -> T } -> T
|
12
|
+
end
|
13
|
+
|
14
|
+
class GenericServer
|
15
|
+
@shutdown_pipe: [IO, IO]?
|
16
|
+
|
17
|
+
attr_reader status: :Stop | :Running | :Shutdown
|
18
|
+
|
19
|
+
attr_reader config: Hash[Symbol, untyped]
|
20
|
+
|
21
|
+
attr_reader logger: BasicLog
|
22
|
+
|
23
|
+
attr_reader tokens: Thread::SizedQueue
|
24
|
+
|
25
|
+
attr_reader listeners: Array[TCPServer| OpenSSL::SSL::SSLServer]
|
26
|
+
|
27
|
+
def initialize: (?Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void
|
28
|
+
|
29
|
+
def []: (Symbol key) -> untyped
|
30
|
+
|
31
|
+
def listen: (String address, Integer port) -> void
|
32
|
+
|
33
|
+
def start: () ?{ (TCPSocket) -> void } -> void
|
34
|
+
|
35
|
+
def stop: () -> void
|
36
|
+
|
37
|
+
def shutdown: () -> void
|
38
|
+
|
39
|
+
def run: (TCPSocket sock) -> void
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def accept_client: (TCPServer svr) -> TCPSocket?
|
44
|
+
|
45
|
+
def start_thread: (TCPSocket sock) ?{ (TCPSocket) -> void } -> Thread
|
46
|
+
|
47
|
+
def call_callback: (Symbol callback_name, *untyped args) -> untyped
|
48
|
+
|
49
|
+
def setup_shutdown_pipe: () -> [IO, IO]
|
50
|
+
|
51
|
+
def cleanup_shutdown_pipe: ([IO, IO]? shutdown_pipe) -> void
|
52
|
+
|
53
|
+
def alarm_shutdown_pipe: [T] () { (IO) -> T } -> T?
|
54
|
+
|
55
|
+
def cleanup_listener: () -> void
|
56
|
+
end
|
57
|
+
end
|
data/sig/ssl.rbs
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module Config
|
3
|
+
SSL: Hash[Symbol, untyped]
|
4
|
+
end
|
5
|
+
|
6
|
+
module Utils
|
7
|
+
def self?.create_self_signed_cert: (untyped bits, untyped cn, untyped comment) -> ::Array[untyped]
|
8
|
+
end
|
9
|
+
|
10
|
+
class GenericServer
|
11
|
+
@ssl_context: OpenSSL::SSL::SSLContext?
|
12
|
+
|
13
|
+
def ssl_context: () -> OpenSSL::SSL::SSLContext?
|
14
|
+
|
15
|
+
def setup_ssl_context: (Hash[Symbol, untyped] config) -> OpenSSL::SSL::SSLContext
|
16
|
+
|
17
|
+
def ssl_servername_callback: (untyped sslsocket, ?untyped? hostname) -> untyped
|
18
|
+
end
|
19
|
+
end
|
data/sig/utils.rbs
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module Utils
|
3
|
+
#
|
4
|
+
# Sets IO operations on +io+ to be non-blocking
|
5
|
+
def self?.set_non_blocking: (IO io) -> void
|
6
|
+
|
7
|
+
#
|
8
|
+
# Sets the close on exec flag for +io+
|
9
|
+
def self?.set_close_on_exec: (IO io) -> void
|
10
|
+
|
11
|
+
#
|
12
|
+
# Changes the process's uid and gid to the ones of +user+
|
13
|
+
def self?.su: (String user) -> void
|
14
|
+
|
15
|
+
#
|
16
|
+
# The server hostname
|
17
|
+
def self?.getservername: () -> String
|
18
|
+
|
19
|
+
#
|
20
|
+
# Creates TCP server sockets bound to +address+:+port+ and returns them.
|
21
|
+
#
|
22
|
+
# It will create IPV4 and IPV6 sockets on all interfaces.
|
23
|
+
def self?.create_listeners: (String host, Integer port) -> Array[TCPServer]
|
24
|
+
|
25
|
+
#
|
26
|
+
# Characters used to generate random strings
|
27
|
+
RAND_CHARS: String
|
28
|
+
|
29
|
+
#
|
30
|
+
# Generates a random string of length +len+
|
31
|
+
def self?.random_string: (Integer len) -> String
|
32
|
+
|
33
|
+
#
|
34
|
+
# Class used to manage timeout handlers across multiple threads.
|
35
|
+
#
|
36
|
+
# Timeout handlers should be managed by using the class methods which are
|
37
|
+
# synchronized.
|
38
|
+
#
|
39
|
+
# id = TimeoutHandler.register(10, Timeout::Error)
|
40
|
+
# begin
|
41
|
+
# sleep 20
|
42
|
+
# puts 'foo'
|
43
|
+
# ensure
|
44
|
+
# TimeoutHandler.cancel(id)
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# will raise Timeout::Error
|
48
|
+
#
|
49
|
+
# id = TimeoutHandler.register(10, Timeout::Error)
|
50
|
+
# begin
|
51
|
+
# sleep 5
|
52
|
+
# puts 'foo'
|
53
|
+
# ensure
|
54
|
+
# TimeoutHandler.cancel(id)
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# will print 'foo'
|
58
|
+
#
|
59
|
+
class TimeoutHandler
|
60
|
+
@queue: Thread::Queue
|
61
|
+
|
62
|
+
@watcher: Thread?
|
63
|
+
|
64
|
+
include Singleton
|
65
|
+
|
66
|
+
#
|
67
|
+
# Mutex used to synchronize access across threads
|
68
|
+
TimeoutMutex: Thread::Mutex
|
69
|
+
|
70
|
+
#
|
71
|
+
# Registers a new timeout handler
|
72
|
+
#
|
73
|
+
# +time+:: Timeout in seconds
|
74
|
+
# +exception+:: Exception to raise when timeout elapsed
|
75
|
+
def self.register: (Numeric seconds, singleton(Exception) exception) -> Integer
|
76
|
+
|
77
|
+
#
|
78
|
+
# Cancels the timeout handler +id+
|
79
|
+
def self.cancel: (Integer id) -> bool
|
80
|
+
|
81
|
+
def self.terminate: () -> Thread?
|
82
|
+
|
83
|
+
#
|
84
|
+
# Creates a new TimeoutHandler. You should use ::register and ::cancel
|
85
|
+
# instead of creating the timeout handler directly.
|
86
|
+
def initialize: () -> void
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def watch: () -> bot
|
91
|
+
|
92
|
+
def watcher: () -> Thread
|
93
|
+
|
94
|
+
public
|
95
|
+
|
96
|
+
#
|
97
|
+
# Interrupts the timeout handler +id+ and raises +exception+
|
98
|
+
def interrupt: (Thread thread, Integer id, singleton(Exception) exception) -> nil
|
99
|
+
|
100
|
+
#
|
101
|
+
# Registers a new timeout handler
|
102
|
+
#
|
103
|
+
# +time+:: Timeout in seconds
|
104
|
+
# +exception+:: Exception to raise when timeout elapsed
|
105
|
+
def register: (Thread thread, Numeric time, singleton(Exception) exception) -> Integer
|
106
|
+
|
107
|
+
#
|
108
|
+
# Cancels the timeout handler +id+
|
109
|
+
def cancel: (Thread thread, Integer id) -> bool
|
110
|
+
|
111
|
+
#
|
112
|
+
def terminate: () -> Thread?
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# Executes the passed block and raises +exception+ if execution takes more
|
117
|
+
# than +seconds+.
|
118
|
+
#
|
119
|
+
# If +seconds+ is zero or nil, simply executes the block
|
120
|
+
def self?.timeout: [T] (Numeric? seconds, ?singleton(Exception) exception) { (?Numeric) -> T } -> T
|
121
|
+
end
|
122
|
+
end
|
data/sig/version.rbs
ADDED
data/webrick.gemspec
CHANGED
@@ -53,6 +53,41 @@ Gem::Specification.new do |s|
|
|
53
53
|
"lib/webrick/ssl.rb",
|
54
54
|
"lib/webrick/utils.rb",
|
55
55
|
"lib/webrick/version.rb",
|
56
|
+
"sig/accesslog.rbs",
|
57
|
+
"sig/cgi.rbs",
|
58
|
+
"sig/compat.rbs",
|
59
|
+
"sig/config.rbs",
|
60
|
+
"sig/cookie.rbs",
|
61
|
+
"sig/htmlutils.rbs",
|
62
|
+
"sig/httpauth.rbs",
|
63
|
+
"sig/httpauth/authenticator.rbs",
|
64
|
+
"sig/httpauth/basicauth.rbs",
|
65
|
+
"sig/httpauth/digestauth.rbs",
|
66
|
+
"sig/httpauth/htdigest.rbs",
|
67
|
+
"sig/httpauth/htgroup.rbs",
|
68
|
+
"sig/httpauth/htpasswd.rbs",
|
69
|
+
"sig/httpauth/userdb.rbs",
|
70
|
+
"sig/httpproxy.rbs",
|
71
|
+
"sig/httprequest.rbs",
|
72
|
+
"sig/httpresponse.rbs",
|
73
|
+
"sig/https.rbs",
|
74
|
+
"sig/httpserver.rbs",
|
75
|
+
"sig/httpservlet.rbs",
|
76
|
+
"sig/httpservlet/abstract.rbs",
|
77
|
+
"sig/httpservlet/cgi_runner.rbs",
|
78
|
+
"sig/httpservlet/cgihandler.rbs",
|
79
|
+
"sig/httpservlet/erbhandler.rbs",
|
80
|
+
"sig/httpservlet/filehandler.rbs",
|
81
|
+
"sig/httpservlet/prochandler.rbs",
|
82
|
+
"sig/httpstatus.rbs",
|
83
|
+
"sig/httputils.rbs",
|
84
|
+
"sig/httpversion.rbs",
|
85
|
+
"sig/log.rbs",
|
86
|
+
"sig/manifest.yaml",
|
87
|
+
"sig/server.rbs",
|
88
|
+
"sig/ssl.rbs",
|
89
|
+
"sig/utils.rbs",
|
90
|
+
"sig/version.rbs",
|
56
91
|
"webrick.gemspec",
|
57
92
|
]
|
58
93
|
s.required_ruby_version = ">= 2.4.0"
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webrick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAKAHASHI Masayoshi
|
8
8
|
- GOTOU YUUZOU
|
9
9
|
- Eric Wong
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: WEBrick is an HTTP server toolkit that can be configured as an HTTPS
|
16
16
|
server, a proxy server, and a virtual-host server.
|
17
17
|
email:
|
18
|
-
-
|
19
|
-
-
|
18
|
+
-
|
19
|
+
-
|
20
20
|
- normal@ruby-lang.org
|
21
21
|
executables: []
|
22
22
|
extensions: []
|
@@ -61,6 +61,41 @@ files:
|
|
61
61
|
- lib/webrick/ssl.rb
|
62
62
|
- lib/webrick/utils.rb
|
63
63
|
- lib/webrick/version.rb
|
64
|
+
- sig/accesslog.rbs
|
65
|
+
- sig/cgi.rbs
|
66
|
+
- sig/compat.rbs
|
67
|
+
- sig/config.rbs
|
68
|
+
- sig/cookie.rbs
|
69
|
+
- sig/htmlutils.rbs
|
70
|
+
- sig/httpauth.rbs
|
71
|
+
- sig/httpauth/authenticator.rbs
|
72
|
+
- sig/httpauth/basicauth.rbs
|
73
|
+
- sig/httpauth/digestauth.rbs
|
74
|
+
- sig/httpauth/htdigest.rbs
|
75
|
+
- sig/httpauth/htgroup.rbs
|
76
|
+
- sig/httpauth/htpasswd.rbs
|
77
|
+
- sig/httpauth/userdb.rbs
|
78
|
+
- sig/httpproxy.rbs
|
79
|
+
- sig/httprequest.rbs
|
80
|
+
- sig/httpresponse.rbs
|
81
|
+
- sig/https.rbs
|
82
|
+
- sig/httpserver.rbs
|
83
|
+
- sig/httpservlet.rbs
|
84
|
+
- sig/httpservlet/abstract.rbs
|
85
|
+
- sig/httpservlet/cgi_runner.rbs
|
86
|
+
- sig/httpservlet/cgihandler.rbs
|
87
|
+
- sig/httpservlet/erbhandler.rbs
|
88
|
+
- sig/httpservlet/filehandler.rbs
|
89
|
+
- sig/httpservlet/prochandler.rbs
|
90
|
+
- sig/httpstatus.rbs
|
91
|
+
- sig/httputils.rbs
|
92
|
+
- sig/httpversion.rbs
|
93
|
+
- sig/log.rbs
|
94
|
+
- sig/manifest.yaml
|
95
|
+
- sig/server.rbs
|
96
|
+
- sig/ssl.rbs
|
97
|
+
- sig/utils.rbs
|
98
|
+
- sig/version.rbs
|
64
99
|
- webrick.gemspec
|
65
100
|
homepage: https://github.com/ruby/webrick
|
66
101
|
licenses:
|
@@ -68,7 +103,7 @@ licenses:
|
|
68
103
|
- BSD-2-Clause
|
69
104
|
metadata:
|
70
105
|
bug_tracker_uri: https://github.com/ruby/webrick/issues
|
71
|
-
post_install_message:
|
106
|
+
post_install_message:
|
72
107
|
rdoc_options: []
|
73
108
|
require_paths:
|
74
109
|
- lib
|
@@ -83,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
118
|
- !ruby/object:Gem::Version
|
84
119
|
version: '0'
|
85
120
|
requirements: []
|
86
|
-
rubygems_version: 3.5.
|
87
|
-
signing_key:
|
121
|
+
rubygems_version: 3.5.11
|
122
|
+
signing_key:
|
88
123
|
specification_version: 4
|
89
124
|
summary: HTTP server toolkit
|
90
125
|
test_files: []
|