returns an Array of the path split on ‘/’
private setter for dn val
private setter for attributes val
private setter for to v
Constructs the default Hash of Regexp’s
Constructs the default Hash of Regexp’s
The content-length header
The content-type header
The content-length header
Sets the content-length header to len
The content-type header
Sets the content-type header to type
Redirects to url with a WEBrick::HTTPStatus::Redirect status.
Example:
res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
Calls the given block once for each key, value pair in the database.
Returns self.
Returns the number of threads waiting on the queue.
Returns the number of threads waiting on the queue.
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 true if the invalid byte sequence error is caused by premature end of string.
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") begin ec.convert("abc\xA1z") rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "z" on EUC-JP> p $!.incomplete_input? #=> false end begin ec.convert("abc\xA1") ec.finish rescue Encoding::InvalidByteSequenceError p $! #=> #<Encoding::InvalidByteSequenceError: incomplete "\xA1" on EUC-JP> p $!.incomplete_input? #=> true end
Returns the corresponding ASCII compatible encoding.
Returns nil if the argument is an ASCII compatible encoding.
“corresponding ASCII compatible encoding” is an ASCII compatible encoding which can represents exactly the same characters as the given ASCII incompatible encoding. So, no conversion undefined error occurs when converting between the two encodings.
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP> Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8> Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
Returns an exception object for the last conversion. Returns nil if the last conversion did not produce an error.
“error” means that Encoding::InvalidByteSequenceError and Encoding::UndefinedConversionError for Encoding::Converter#convert and :invalid_byte_sequence, :incomplete_input and :undefined_conversion for Encoding::Converter#primitive_convert.
ec = Encoding::Converter.new("utf-8", "iso-8859-1") p ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence p ec.last_error #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8> p ec.primitive_convert(src, dst, nil, 1) #=> :destination_buffer_full p ec.last_error #=> nil
Similar to read, but raises EOFError at end of string unless the +exception: false+ option is passed in.
Consumes size bytes from the buffer
Reads at most maxlen bytes in the non-blocking manner.
When no data can be read without blocking it raises OpenSSL::SSL::SSLError extended by IO::WaitReadable or IO::WaitWritable.
IO::WaitReadable means SSL needs to read internally so read_nonblock should be called again when the underlying IO is readable.
IO::WaitWritable means SSL needs to write internally so read_nonblock should be called again after the underlying IO is writable.
OpenSSL::Buffering#read_nonblock needs two rescue clause as follows:
# emulates blocking read (readpartial). begin result = ssl.read_nonblock(maxlen) rescue IO::WaitReadable IO.select([io]) retry rescue IO::WaitWritable IO.select(nil, [io]) retry end
Note that one reason that read_nonblock writes to the underlying IO is when the peer requests a new TLS/SSL handshake. See openssl the FAQ for more details. www.openssl.org/support/faq.html
By specifying ‘exception: false`, the options hash allows you to indicate that read_nonblock should not raise an IO::Wait*able exception, but return the symbol :wait_writable or :wait_readable instead.