Checks the host v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :HOST.
Can not have a registry or opaque component defined, with a host component defined.
Checks the port v
component for RFC2396 compliance and against the URI::Parser
Regexp
for :PORT.
Can not have a registry or opaque component defined, with a port component defined.
Calculates relative path to oth from self.
require 'uri' uri = URI.parse('http://my.example.com') uri.route_to('http://my.example.com/main.rbx?page=1') #=> #<URI::Generic /main.rbx?page=1>
Checks the to v
component.
Private setter for to v
.
Returns the RFC822 e-mail text equivalent of the URL, as a String
.
Example:
require 'uri' uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") uri.to_mailtext # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
Returns Regexp
that is default self.regexp, unless schemes
is provided. Then it is a Regexp.union
with self.pattern.
Constructs the default Hash
of Regexp’s.
Returns Regexp
that is default self.regexp, unless schemes
is provided. Then it is a Regexp.union
with self.pattern.
Constructs the default Hash
of Regexp’s.
Prepares the HTTPRequest
object for use as the source for IO.copy_stream
The client’s IP address
The response’s HTTP status line
Creates an error page for exception ex
with an optional backtrace
Adds server
as a virtual host.
Converts the contents of the database to an in-memory Hash
object, and returns it.
Returns the destination encoding as an encoding object.
Returns the one-character string which cause Encoding::UndefinedConversionError
.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") begin ec.convert("\xa0") rescue Encoding::UndefinedConversionError puts $!.error_char.dump #=> "\xC2\xA0" p $!.error_char.encoding #=> #<Encoding:UTF-8> end
Returns the destination encoding as an encoding object.
Returns the discarded bytes when Encoding::InvalidByteSequenceError
occurs.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") begin ec.convert("abc\xA1\xFFdef") rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP> puts $!.error_bytes.dump #=> "\xA1" puts $!.readagain_bytes.dump #=> "\xFF" end
Returns the bytes to be read again when Encoding::InvalidByteSequenceError
occurs.
Returns the destination encoding as an Encoding
object.