Class FTW::Request
In: lib/ftw/request.rb
lib/ftw/request.rb
Parent: Object

An HTTP Request.

See RFC2616 section 5: <tools.ietf.org/html/rfc2616#section-5>

Methods

Included Modules

FTW::HTTP::Message FTW::Protocol FTW::CRLF Cabin::Inspectable FTW::HTTP::Message FTW::Protocol FTW::CRLF Cabin::Inspectable

External Aliases

request_uri -> path
  Lemmings. Everyone else calls Request-URI the ‘path’ (including me, most of the time), so let‘s just follow along.
request_uri -> path
  Lemmings. Everyone else calls Request-URI the ‘path’ (including me, most of the time), so let‘s just follow along.

Attributes

method  [RW]  The http method. Like GET, PUT, POST, etc.. RFC2616 5.1.1 - <tools.ietf.org/html/rfc2616#section-5.1.1>

Warning: this accessor obscures the ruby Kernel#method() method. I would like to call this ‘verb’, but my preference is first to adhere to RFC terminology. Further, ruby‘s stdlib Net::HTTP calls this ‘method’ as well (See Net::HTTPGenericRequest).

method  [RW]  The http method. Like GET, PUT, POST, etc.. RFC2616 5.1.1 - <tools.ietf.org/html/rfc2616#section-5.1.1>

Warning: this accessor obscures the ruby Kernel#method() method. I would like to call this ‘verb’, but my preference is first to adhere to RFC terminology. Further, ruby‘s stdlib Net::HTTP calls this ‘method’ as well (See Net::HTTPGenericRequest).

port  [RW]  RFC2616 section 14.23 allows the Host header to include a port, but I have never seen this in practice, and I shudder to think about what poorly-behaving web servers will barf if the Host header includes a port. So, instead of storing the port in the Host header, it is stored here. It is not included in the Request when sent from a client and it is not used on a server.
port  [RW]  RFC2616 section 14.23 allows the Host header to include a port, but I have never seen this in practice, and I shudder to think about what poorly-behaving web servers will barf if the Host header includes a port. So, instead of storing the port in the Host header, it is stored here. It is not included in the Request when sent from a client and it is not used on a server.
protocol  [RW]  This is not an RFC2616 field. It exists so that the connection handling this request knows what protocol to use. The protocol for this request. Usually ‘http’ or ‘https’ or perhaps ‘spdy’ maybe?
protocol  [RW]  This is not an RFC2616 field. It exists so that the connection handling this request knows what protocol to use. The protocol for this request. Usually ‘http’ or ‘https’ or perhaps ‘spdy’ maybe?
request_uri  [RW]  This is the Request-URI. Many people call this the ‘path’ of the request. RFC2616 5.1.2 - <tools.ietf.org/html/rfc2616#section-5.1.2>
request_uri  [RW]  This is the Request-URI. Many people call this the ‘path’ of the request. RFC2616 5.1.2 - <tools.ietf.org/html/rfc2616#section-5.1.2>

Public Class methods

Make a new request with a uri if given.

The uri is used to set the address, protocol, Host header, etc.

Make a new request with a uri if given.

The uri is used to set the address, protocol, Host header, etc.

Public Instance methods

Execute this request on a given connection: Writes the request, returns a Response object.

This method will block until the HTTP response header has been completely received. The body will not have been read yet at the time of this method‘s return.

The ‘connection’ should be a FTW::Connection instance, but it might work with a normal IO object.

Execute this request on a given connection: Writes the request, returns a Response object.

This method will block until the HTTP response header has been completely received. The body will not have been read yet at the time of this method‘s return.

The ‘connection’ should be a FTW::Connection instance, but it might work with a normal IO object.

Set the method for this request. Usually something like "GET" or "PUT" etc. See <tools.ietf.org/html/rfc2616#section-5.1.1>

Set the method for this request. Usually something like "GET" or "PUT" etc. See <tools.ietf.org/html/rfc2616#section-5.1.1>

Get the request line (first line of the http request) From the RFC: Request-Line = Method SP Request-URI SP HTTP-Version CRLF

Note: I skip the trailing CRLF. See the to_s method where it is provided.

Get the request line (first line of the http request) From the RFC: Request-Line = Method SP Request-URI SP HTTP-Version CRLF

Note: I skip the trailing CRLF. See the to_s method where it is provided.

start_line()

Alias for request_line

start_line()

Alias for request_line

Use a URI to help fill in parts of this Request.

Use a URI to help fill in parts of this Request.

[Validate]