module HTTP1

Extends
Configurable: .new

Provides HTTP/1.0 and HTTP/1.1 client and server implementations.

Nested Classes and Modules

class Client

An HTTP/1 client connection that sends requests and reads responses.

class Connection

An HTTP/1 connection that wraps an IO stream with version and state tracking.

class Finishable

Keeps track of whether a body is being read, and if so, waits for it to be closed.

class Request

An incoming HTTP/1 request parsed from the connection.

class Response

An HTTP/1 response received from a server.

class Server

An HTTP/1 server connection that receives requests and sends responses.

Definitions

def self.bidirectional?

Signature

returns Boolean

Whether the protocol supports bidirectional communication.

Implementation

def self.bidirectional?
	true
end

def self.trailer?

Signature

returns Boolean

Whether the protocol supports trailers.

Implementation

def self.trailer?
	true
end

def self.client(peer, **options)

Create a client for an outbound connection.

Signature

parameter peer IO

The peer to communicate with.

parameter options Hash

Options to pass to the client instance.

Implementation

def self.client(peer, **options)
	stream = ::IO::Stream(peer)
	
	return HTTP1::Client.new(stream, VERSION, **options)
end

def self.server(peer, **options)

Create a server for an inbound connection.

Signature

parameter peer IO

The peer to communicate with.

parameter options Hash

Options to pass to the server instance.

Implementation

def self.server(peer, **options)
	stream = ::IO::Stream(peer)
	
	return HTTP1::Server.new(stream, VERSION, **options)
end

def self.names

Signature

returns Array

The names of the supported protocol.

Implementation

def self.names
	["http/1.1", "http/1.0"]
end