Returns a new instance of the C struct with the value ty
at the addr
address.
Returns a new Fiddle::Pointer
instance at the memory address of the given name
symbol.
Raises a DLError
if the name
doesn’t exist.
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 a keyword argument exception to false
, you can indicate that read_nonblock
should not raise an IO::Wait*able exception, but return the symbol :wait_writable
or :wait_readable
instead. At EOF, it will return nil
instead of raising EOFError
.
Writes s to the buffer. When the buffer is full or sync
is true the buffer is flushed to the underlying socket.
Generate an Image Button Input element as a string.
src
is the URL of the image to use for the button. name
is the input name. alt
is the alternative text for the image.
Alternatively, the attributes can be specified as a hash.
image_button("url") # <INPUT TYPE="image" SRC="url"> image_button("url", "name", "string") # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string"> image_button("SRC" => "url", "ALT" => "string") # <INPUT TYPE="image" SRC="url" ALT="string">
Generate a Password Input element as a string.
name
is the name of the input field. value
is its default value. size
is the size of the input field display. maxlength
is the maximum length of the inputted password.
Alternatively, attributes can be specified as a hash.
password_field("name") # <INPUT TYPE="password" NAME="name" SIZE="40"> password_field("name", "value") # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40"> password_field("password", "value", 80, 200) # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200"> password_field("NAME" => "name", "VALUE" => "value") # <INPUT TYPE="password" NAME="name" VALUE="value">
Generate a sequence of radio button Input elements, as a String
.
This works the same as checkbox_group()
. However, it is not valid to have more than one radiobutton in a group checked.
radio_group("name", "foo", "bar", "baz") # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo # <INPUT TYPE="radio" NAME="name" VALUE="bar">bar # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz radio_group("name", ["foo"], ["bar", true], "baz") # <INPUT TYPE="radio" NAME="name" VALUE="foo">foo # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="bar">bar # <INPUT TYPE="radio" NAME="name" VALUE="baz">baz radio_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # <INPUT TYPE="radio" NAME="name" VALUE="1">Foo # <INPUT TYPE="radio" CHECKED NAME="name" VALUE="2">Bar # <INPUT TYPE="radio" NAME="name" VALUE="Baz">Baz radio_group("NAME" => "name", "VALUES" => ["foo", "bar", "baz"]) radio_group("NAME" => "name", "VALUES" => [["foo"], ["bar", true], "baz"]) radio_group("NAME" => "name", "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])
Like each_header
, but the keys are returned in capitalized form.
Net::HTTPHeader#canonical_each
is an alias for Net::HTTPHeader#each_capitalized
.
Returns the value of field 'Content-Length'
as an integer, or nil
if there is no such field; see Content-Length request header:
res = Net::HTTP.get_response(hostname, '/nosuch/1') res.content_length # => 2 res = Net::HTTP.get_response(hostname, '/todos/1') res.content_length # => nil
Sets the value of field 'Content-Length'
to the given numeric; see Content-Length response header:
_uri = uri.dup hostname = _uri.hostname # => "jsonplaceholder.typicode.com" _uri.path = '/posts' # => "/posts" req = Net::HTTP::Post.new(_uri) # => #<Net::HTTP::Post POST> req.body = '{"title": "foo","body": "bar","userId": 1}' req.content_length = req.body.size # => 42 req.content_type = 'application/json' res = Net::HTTP.start(hostname) do |http| http.request(req) end # => #<Net::HTTPCreated 201 Created readbody=true>
Returns a Range
object representing the value of field 'Content-Range'
, or nil
if no such field exists; see Content-Range response header:
res = Net::HTTP.get_response(hostname, '/todos/1') res['Content-Range'] # => nil res['Content-Range'] = 'bytes 0-499/1000' res['Content-Range'] # => "bytes 0-499/1000" res.content_range # => 0..499
Returns the media type from the value of field 'Content-Type'
, or nil
if no such field exists; see Content-Type response header:
res = Net::HTTP.get_response(hostname, '/todos/1') res['content-type'] # => "application/json; charset=utf-8" res.content_type # => "application/json"
returns “type/subtype” which is MIME Content-Type. It is downcased for canonicalization. Content-Type parameters are stripped.
Returns a list of encodings in Content-Encoding field as an array of strings.
The encodings are downcased for canonicalization.
Creates an unsigned certificate for subject
and key
. The lifetime of the key is from the current time to age
which defaults to one year.
The extensions
restrict the key to the indicated uses.
Displays an error statement
to the error output location. Asks a question
if given.
foo.bar, = 1 ^^^^^^^