123456789_123456789_123456789_123456789_123456789_

Class: Net::HTTPNetworkAuthenticationRequired

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Net::HTTPServerError
Defined in: lib/net/http/responses.rb

Overview

Response class for Network Authentication Required responses (status code 511).

The client needs to authenticate to gain network access.

This class also includes (indirectly) module HTTPHeader, which gives access to its methods for getting headers.

References:

Constant Summary

HTTPHeader - Included

MAX_FIELD_LENGTH, MAX_KEY_LENGTH

HTTPResponse - Inherited

CODE_CLASS_TO_OBJ, CODE_TO_OBJ

HTTPServerError - Inherited

EXCEPTION_TYPE, HAS_BODY

Class Attribute Summary

HTTPResponse - Inherited

.body_permitted?

true if the response has a body.

Class Method Summary

HTTPResponse - Inherited

.each_response_header, .read_status_line, .response_class,
.exception_type

internal use only.

.new

internal use only.

.read_new

internal use only.

Instance Attribute Summary

HTTPResponse - Inherited

#body

Returns the string response body; note that repeated calls for the unmodified body return a cached string:

#body=

Sets the body of the response to the given value.

#body_encoding

Returns the value set by body_encoding=, or false if none; see #body_encoding=.

#body_encoding=

Sets the encoding that should be used when reading the body:

#code

The HTTP result code string.

#decode_content

Set to true automatically when the request did not contain an Accept-Encoding header from the user.

#http_version

The HTTP version supported by the server.

#ignore_eof

Whether to ignore EOF when reading bodies with a specified Content-Length header.

#message

The HTTP result message sent by the server.

#uri

The URI used to fetch this response.

#entity
#msg
#uri=

HTTPHeader - Included

#chunked?

Returns true if field 'Transfer-Encoding' exists and has value 'chunked', false otherwise; see Transfer-Encoding response header:

#connection_close?

Returns whether the HTTP session is to be closed.

#connection_keep_alive?

Returns whether the HTTP session is to be kept alive.

#content_length

Returns the value of field 'Content-Length' as an integer, or nil if there is no such field; see Content-Length request header:

#content_length=

Sets the value of field 'Content-Length' to the given numeric; see Content-Length response header:

Instance Method Summary

HTTPResponse - Inherited

#inspect,
#read_body

Gets the entity body returned by the remote HTTP server.

#value

Raises an HTTP error if the response is not 2xx (success).

#extracting_encodings_from_meta_elements, #get_attribute, #procdest, #read_body_0, #stream_check,
#code_type

response <-> exception relationship.

#error!, #error_type, #header, #read_header,
#reading_body

body.

#response

header (for backward compatibility only; DO NOT USE).

#check_bom, #detect_encoding,
#inflater

Checks for a supported Content-Encoding header and yields an Inflate wrapper for this response’s socket when zlib is present.

#read_chunked

read_chunked reads from @socket for chunk-size, chunk-extension, CRLF, etc.

#scanning_meta, #sniff_encoding

HTTPHeader - Included

#[]

Returns the string field value for the case-insensitive field key, or nil if there is no such key; see Fields:

#[]=

Sets the value for the case-insensitive key to val, overwriting the previous value if the field exists; see Fields:

#add_field

Adds value val to the value array for field key if the field exists; creates the field with the given key and val if it does not exist.

#basic_auth

Sets header 'Authorization' using the given account and password strings:

#canonical_each
#content_range

Returns a Range object representing the value of field 'Content-Range', or nil if no such field exists; see Content-Range response header:

#content_type

Returns the media type from the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

#content_type=
#delete

Removes the header for the given case-insensitive key (see Fields); returns the deleted value, or nil if no such field exists:

#each
#each_capitalized

Like #each_header, but the keys are returned in capitalized form.

#each_capitalized_name

Calls the block with each capitalized field name:

#each_header

Calls the block with each key/value pair:

#each_key
#each_name

Calls the block with each field key:

#each_value

Calls the block with each string field value:

#fetch

With a block, returns the string value for key if it exists; otherwise returns the value of the block; ignores the default_val; see Fields:

#form_data=
#get_fields

Returns the array field value for the given key, or nil if there is no such field; see Fields:

#key?

Returns true if the field for the case-insensitive key exists, false otherwise:

#main_type

Returns the leading (‘type’) part of the media type from the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

#proxy_basic_auth

Sets header 'Proxy-Authorization' using the given account and password strings:

#range

Returns an array of Range objects that represent the value of field 'Range', or nil if there is no such field; see Range request header:

#range=
#range_length

Returns the integer representing length of the value of field 'Content-Range', or nil if no such field exists; see Content-Range response header:

#set_content_type

Sets the value of field 'Content-Type'; returns the new value; see Content-Type request header:

#set_form

Stores form data to be used in a POST or PUT request.

#set_form_data

Sets the request body to a URL-encoded string derived from argument params, and sets request header field 'Content-Type' to 'application/x-www-form-urlencoded'.

#set_range

Sets the value for field 'Range'; see Range request header:

#sub_type

Returns the trailing (‘subtype’) part of the media type from the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

#to_hash

Returns a hash of the key/value pairs:

#type_params

Returns the trailing (‘parameters’) part of the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

#append_field_value, #basic_encode, #capitalize, #set_field, #initialize_http_header,
#length

Alias for HTTPHeader#size.

#size

obsolete.

Constructor Details

This class inherits a constructor from Net::HTTPResponse