Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bugs and improve #152

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/webrick/httpauth/authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def info(fmt, *args)
# authentication schemes for proxies.

module ProxyAuthenticator
RequestField = "Proxy-Authorization" # :nodoc:
ResponseField = "Proxy-Authenticate" # :nodoc:
InfoField = "Proxy-Authentication-Info" # :nodoc:
AuthException = HTTPStatus::ProxyAuthenticationRequired # :nodoc:
RequestField = "Proxy-Authorization" # :nodoc:
ResponseField = "Proxy-Authenticate" # :nodoc:
ResponseInfoField = "Proxy-Authentication-Info" # :nodoc:
AuthException = HTTPStatus::ProxyAuthenticationRequired # :nodoc:
end
end
end
2 changes: 1 addition & 1 deletion lib/webrick/httpauth/htgroup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def reload
File.open(@path){|io|
while line = io.gets
line.chomp!
group, members = line.split(/:\s*/)
group, members = line.split(/:\s*/, 2)
@group[group] = members.split(/\s+/)
end
}
Expand Down
4 changes: 2 additions & 2 deletions lib/webrick/httpauth/htpasswd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def reload
if @password_hash == :bcrypt
raise StandardError, ".htpasswd file contains crypt password, only bcrypt passwords supported"
end
user, pass = line.split(":")
user, pass = line.split(":", 2)
when %r!\A[^:]+:\$2[aby]\$\d{2}\$.{53}\z!
if @password_hash == :crypt
raise StandardError, ".htpasswd file contains bcrypt password, only crypt passwords supported"
end
user, pass = line.split(":")
user, pass = line.split(":", 2)
when /:\$/, /:{SHA}/
raise NotImplementedError,
'MD5, SHA1 .htpasswd file not supported'
Expand Down
4 changes: 2 additions & 2 deletions lib/webrick/httprequest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def initialize(config)
@script_name = @path_info = nil
@query_string = nil
@query = nil
@form_data = nil

@raw_header = Array.new
@header = nil
Expand All @@ -173,7 +172,8 @@ def initialize(config)
@accept_language = []
@body = +""

@addr = @peeraddr = nil
@addr = []
@peeraddr = []
@attributes = {}
@user = nil
@keep_alive = false
Expand Down
2 changes: 1 addition & 1 deletion sig/httpauth/authenticator.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module WEBrick

ResponseField: String

InfoField: String
ResponseInfoField: String

AuthException: singleton(HTTPStatus::ClientError)
end
Expand Down
6 changes: 2 additions & 4 deletions sig/httprequest.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ module WEBrick

@query: Hash[String, HTTPUtils::FormData]?

@form_data: nil

@body: String

@remaining_size: Integer?
Expand Down Expand Up @@ -72,9 +70,9 @@ module WEBrick

attr_accessor user: String?

attr_reader addr: ([String, Integer, String, String] | [])?
attr_reader addr: ([String, Integer, String, String] | [])

attr_reader peeraddr: ([String, Integer, String, String] | [])?
attr_reader peeraddr: ([String, Integer, String, String] | [])

attr_reader attributes: Hash[untyped, untyped]

Expand Down