faktory-1.1.2.4: Faktory Worker for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Connection.Compat

Description

Synopsis

Documentation

connectionIsSecure :: Connection -> IO Bool #

Returns if the connection is establish securely or not.

connectionSetSecure :: ConnectionContext -> Connection -> TLSSettings -> IO () #

Activate secure layer using the parameters specified.

This is typically used to negociate a TLS channel on an already establish channel, e.g. supporting a STARTTLS command. it also flush the received buffer to prevent application confusing received data before and after the setSecure call.

If the connection is already using TLS, nothing else happens.

connectionClose :: Connection -> IO () #

Close a connection.

connectionGetLine #

Arguments

:: Int

Maximum number of bytes before raising a LineTooLong exception

-> Connection

Connection

-> IO ByteString

The received line with the LF trimmed

Get the next line, using ASCII LF as the line terminator.

This throws an isEOFError exception on end of input, and LineTooLong when the number of bytes gathered is over the limit without a line terminator.

The actual line returned can be bigger than the limit specified, provided that the last chunk returned by the underlaying backend contains a LF. In another world only when we need more input and limit is reached that the LineTooLong exception will be raised.

An end of file will be considered as a line terminator too, if line is not empty.

connectionWaitForInput :: Connection -> Int -> IO Bool #

Wait for input to become available on a connection.

As with hWaitForInput, the timeout value is given in milliseconds. If the timeout value is less than zero, then connectionWaitForInput waits indefinitely.

Unlike hWaitForInput, this function does not do any decoding, so it returns true when there is any available input, not just full characters.

connectionGetChunk' :: Connection -> (ByteString -> (a, ByteString)) -> IO a #

Like connectionGetChunk, but return the unused portion to the buffer, where it will be the next chunk read.

connectionGetChunk :: Connection -> IO ByteString #

Get the next block of data from the connection.

connectionGet :: Connection -> Int -> IO ByteString #

Get some bytes from a connection.

The size argument is just the maximum that could be returned to the user. The call will return as soon as there's data, even if there's less than requested. Hence, it behaves like hGetSome.

On end of input, connectionGet returns 0, but subsequent calls will throw an isEOFError exception.

connectionGetExact :: Connection -> Int -> IO ByteString #

Get exact count of bytes from a connection.

The size argument is the exact amount that must be returned to the user. The call will wait until all data is available. Hence, it behaves like hGet.

On end of input, connectionGetExact will throw an isEOFError exception.

connectionPut :: Connection -> ByteString -> IO () #

Put a block of data in the connection.

connectFromSocket :: ConnectionContext -> Socket -> ConnectionParams -> IO Connection #

Use an already established handle to create a connection object.

if the TLS Settings is set, it will do the handshake with the server. The SOCKS settings have no impact here, as the handle is already established

connectFromHandle :: ConnectionContext -> Handle -> ConnectionParams -> IO Connection #

Use an already established handle to create a connection object.

if the TLS Settings is set, it will do the handshake with the server. The SOCKS settings have no impact here, as the handle is already established

initConnectionContext :: IO ConnectionContext #

Initialize the library with shared parameters between connection.

data LineTooLong #

This is the exception raised if we reached the user specified limit for the line in ConnectionGetLine.

Constructors

LineTooLong 

data HostNotResolved #

Exception raised when there's no resolution for a specific host

Constructors

HostNotResolved String 

data ConnectionParams #

Connection Parameters to establish a Connection.

The strict minimum is an hostname and the port.

If you need to establish a TLS connection, you should make sure connectionUseSecure is correctly set.

If you need to connect through a SOCKS, you should make sure connectionUseSocks is correctly set.

Constructors

ConnectionParams 

Fields

data ProxySettings #

Proxy settings for the connection.

OtherProxy handles specific application-level proxies like HTTP proxies.

The simple SOCKS settings is just the hostname and portnumber of the SOCKS proxy server.

That's for now the only settings in the SOCKS package, socks password, or any sort of other authentications is not yet implemented.

data TLSSettings #

TLS Settings that can be either expressed as simple settings, or as full blown TLS.Params settings.

Unless you need access to parameters that are not accessible through the simple settings, you should use TLSSettingsSimple.

Constructors

TLSSettingsSimple 

Fields

TLSSettings ClientParams

full blown TLS Settings directly using TLS.Params. for power users.

Instances

Instances details
Show TLSSettings 
Instance details

Defined in Network.Connection.Types

Default TLSSettings 
Instance details

Defined in Network.Connection.Types

Methods

def :: TLSSettings #

data Connection #

This opaque type represent a connection to a destination.

data ConnectionContext #

Shared values (certificate store, sessions, ..) between connections

At the moment, this is only strictly needed to shared sessions and certificates when using a TLS enabled connection.