Create a new DRbServer instance.
uri
is the URI
to bind to. This is normally of the form ‘druby://<hostname>:<port>’ where <hostname> is a hostname of the local machine. If nil, then the system’s default hostname will be bound to, on a port selected by the system; these value can be retrieved from the uri
attribute. ‘druby:’ specifies the default dRuby transport protocol: another protocol, such as ‘drbunix:’, can be specified instead.
front
is the front object for the server, that is, the object to which remote method calls on the server will be passed. If nil, then the server will not accept remote method calls.
If config_or_acl
is a hash, it is the configuration to use for this server. The following options are recognised:
an id-to-object conversion object. This defaults to an instance of the class DRb::DRbIdConv
.
if true, all unsuccessful remote calls on objects in the server will be logged to $stdout. false by default.
the access control list for this server. See the ACL
class from the main dRuby distribution.
the maximum message size in bytes accepted by the server. Defaults to 25 MB (26214400).
the maximum number of arguments to a remote method accepted by the server. Defaults to 256.
The default values of these options can be modified on a class-wide basis by the class methods default_argc_limit, default_load_limit, default_acl, default_id_conv, and verbose=
If config_or_acl
is not a hash, but is not nil, it is assumed to be the access control list for this server. See the :tcp_acl option for more details.
If no other server is currently set as the primary server, this will become the primary server.
The server will immediately start running in its own thread.
Create a new remote object stub.
obj
is the (local) object we want to create a stub for. Normally this is nil
. uri
is the URI
of the remote object that this will be a stub for.
Creates a new GW
Create a DRb::DRbSSLSocket
instance.
uri
is the URI
we are connected to. soc
is the tcp socket we are bound to. config
is our configuration. Either a Hash
or SSLConfig
is_established
is a boolean of whether soc
is currently established
This is called automatically based on the DRb
protocol.
Creates a new TimerIdConv
which will hold objects for keeping
seconds.
Creates a new StringInputMethod
object
Returns a new Net::HTTP
object http
(but does not open a TCP connection or HTTP
session).
No Proxy
With only string argument hostname
given (and ENV['http_proxy']
undefined or nil
), the returned http
:
Has the given address.
Has the default port number, Net::HTTP.default_port
(80).
Has no proxy.
Example:
http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.address # => "jsonplaceholder.typicode.com" http.port # => 80 http.proxy? # => false
With integer argument port
also given, the returned http
has the given port:
http = Net::HTTP.new(hostname, 8000) # => #<Net::HTTP jsonplaceholder.typicode.com:8000 open=false> http.port # => 8000
Proxy Using Argument p_addr
as a String
When argument p_addr
is a string hostname, the returned http
has a proxy:
http = Net::HTTP.new(hostname, nil, 'proxy.example') # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.proxy? # => true http.proxy_address # => "proxy.example" # These use default values. http.proxy_port # => 80 http.proxy_user # => nil http.proxy_pass # => nil
The port, username, and password for the proxy may also be given:
http = Net::HTTP.new(hostname, nil, 'proxy.example', 8000, 'pname', 'ppass') # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.proxy? # => true http.proxy_address # => "proxy.example" http.proxy_port # => 8000 http.proxy_user # => "pname" http.proxy_pass # => "ppass"
Proxy Using ENV['http_proxy']
When environment variable 'http_proxy'
is set to a URI string, the returned http
will have that URI
as its proxy; note that the URI string must have a protocol such as 'http'
or 'https'
:
ENV['http_proxy'] = 'http://example.com' # => "http://example.com" http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.proxy? # => true http.address # => "jsonplaceholder.typicode.com" http.proxy_address # => "example.com"
The URI string may include proxy username, password, and port number:
ENV['http_proxy'] = 'http://pname:ppass@example.com:8000' # => "http://pname:ppass@example.com:8000" http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.proxy_port # => 8000 http.proxy_user # => "pname" http.proxy_pass # => "ppass"
Argument p_no_proxy
You can use argument p_no_proxy
to reject certain proxies:
Reject a certain address:
http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example') http.proxy_address # => nil
Reject certain domains or subdomains:
http = Net::HTTP.new('example.com', nil, 'my.proxy.example', 8000, 'pname', 'ppass', 'proxy.example') http.proxy_address # => nil
Reject certain addresses and port combinations:
http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example:1234') http.proxy_address # => "proxy.example" http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'proxy.example:8000') http.proxy_address # => nil
Reject a list of the types above delimited using a comma:
http = Net::HTTP.new('example.com', nil, 'proxy.example', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000') http.proxy_address # => nil http = Net::HTTP.new('example.com', nil, 'my.proxy', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000') http.proxy_address # => nil
Creates an HTTP request object for path
.
initheader
are the default headers to use. Net::HTTP
adds Accept-Encoding to enable compression of the response body unless Accept-Encoding or Range
are supplied in initheader
.
Creates a new URI::FTP
object from generic URL components with no syntax checking.
Unlike build(), this method does not escape the path component as required by RFC1738; instead it is treated as per RFC2396.
Arguments are scheme
, userinfo
, host
, port
, registry
, path
, opaque
, query
, and fragment
, in that order.
Just initializes all instance variables.