Creates a new URI
formatter for uri
.
Creates a new StreamUI
wrapping in_stream
for user input, out_stream
for standard output, err_stream
for error output. If usetty
is true then special operations (like asking for passwords) will use the TTY commands to disable character echo.
The Console UI has no arguments as it defaults to reading input from stdin, output to stdout and warnings or errors to stderr.
The SilentUI
has no arguments as it does not use any stream.
scheme
Protocol scheme, i.e. ‘http’,‘ftp’,‘mailto’ and so on.
userinfo
User name and password, i.e. ‘sdmitry:bla’
host
Server host name
port
Server port
registry
Registry of naming authorities.
path
Path on server
opaque
Opaque part
query
Query data
fragment
A part of URI
after ‘#’ sign
parser
Parser
for internal use [URI::DEFAULT_PARSER by default]
arg_check
Check arguments [false by default]
Creates a new URI::Generic
instance from “generic” components without check.
Create a new URI::LDAP
object from generic URI
components as per RFC 2396. No LDAP-specific syntax checking is performed.
Arguments are scheme
, userinfo
, host
, port
, registry
, path
, opaque
, query
and fragment
, in that order.
Example:
uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, "/dc=example;dc=com", "query", nil, nil, nil, nil)
See also URI::Generic.new
Creates a new URI::MailTo
object from generic URL components with no syntax checking.
This method is usually called from URI::parse
, which checks the validity of each component.
URI::Parser.new([opts])
The constructor accepts a hash as options for parser. Keys of options are pattern names of URI
components and values of options are pattern strings. The constructor generates set of regexps for parsing URIs.
You can use the following keys:
* :ESCAPED (URI::PATTERN::ESCAPED in default) * :UNRESERVED (URI::PATTERN::UNRESERVED in default) * :DOMLABEL (URI::PATTERN::DOMLABEL in default) * :TOPLABEL (URI::PATTERN::TOPLABEL in default) * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})") u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP:0xb78cf4f8 URL:http://example.jp/%uABCD> URI.parse(u.to_s) #=> raises URI::InvalidURIError s = "http://example.com/ABCD" u1 = p.parse(s) #=> #<URI::HTTP:0xb78c3220 URL:http://example.com/ABCD> u2 = URI.parse(s) #=> #<URI::HTTP:0xb78b6d54 URL:http://example.com/ABCD> u1 == u2 #=> true u1.eql?(u2) #=> false
Creates a new CGI
interface.
The first argument in args
is a configuration hash which would update WEBrick::Config::HTTP.
Any remaining arguments are stored in the @options
instance variable for use by a subclass.
Creates a new cookie with the given name
and value
Proxy server configurations. The proxy server handles the following configuration items in addition to those supported by HTTPServer:
Called with a request and response to authorize a request
Appended to the via header
The proxy server’s URI
Called with a request and response and allows modification of the response
Sets the proxy timeouts to 30 seconds for open and 60 seconds for read operations
Creates a new HTTP request. WEBrick::Config::HTTP is the default configuration.