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

[DOC] Enhanced RDoc for Net::HTTP #118

Merged
merged 1 commit into from
Feb 7, 2023
Merged
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
19 changes: 13 additions & 6 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1472,12 +1472,15 @@ def proxy_class?
attr_reader :proxy_pass
end

# True if requests for this connection will be proxied
# Returns +true+ if a proxy server is defined, +false+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy?
!!(@proxy_from_env ? proxy_uri : @proxy_address)
end

# True if the proxy for this connection is determined from the environment
# Returns +true+ if the proxy server is defined in the environment,
# +false+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy_from_env?
@proxy_from_env
end
Expand All @@ -1491,7 +1494,8 @@ def proxy_uri # :nodoc:
@proxy_uri || nil
end

# The address of the proxy server, if one is configured.
# Returns the address of the proxy server, if defined, +nil+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy_address
if @proxy_from_env then
proxy_uri&.hostname
Expand All @@ -1500,7 +1504,8 @@ def proxy_address
end
end

# The port of the proxy server, if one is configured.
# Returns the port number of the proxy server, if defined, +nil+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy_port
if @proxy_from_env then
proxy_uri&.port
Expand All @@ -1509,7 +1514,8 @@ def proxy_port
end
end

# The username of the proxy server, if one is configured.
# Returns the user name of the proxy server, if defined, +nil+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy_user
if @proxy_from_env
user = proxy_uri&.user
Expand All @@ -1519,7 +1525,8 @@ def proxy_user
end
end

# The password of the proxy server, if one is configured.
# Returns the password of the proxy server, if defined, +nil+ otherwise;
# see {Proxy Server}[rdoc-ref:Net::HTTP@Proxy+Server].
def proxy_pass
if @proxy_from_env
pass = proxy_uri&.password
Expand Down