network-minihttp-0.2: A ByteString based library for writing HTTP(S) servers and clients.

Network.MiniHTTP.Client

Description

This module contains a very basic HTTP client. At the moment, it doesn't even handle redirects for you.

Note that, in order to use SSL, you need to have the root CA certificates in a PEM file in etcssh/certs.pem and you need to have wrapped your main function in OpenSSL.withOpenSSL

Synopsis

Documentation

fetchBasicSource

Arguments

:: Headers

the headers to use. This function will set the Host header for you in the case that the URL has a hostname in it. If in doubt, use emptyHeaders

-> URL

the resource to fetch

-> IO (Connection, Reply, Maybe Source)

the connection (which you have to close once you are done reading the Source, if any), the Reply and a possible payload

Fetch an HTTP(S) entity.

connection :: URL -> IO SocketSource

Construct a connection to the correct host for the given URL. (i.e. resolve the hostname and create a TCP connection to the correct port).

Note that the DNS resolution (if any) doesn't block the whole process.

transport :: URL -> Socket -> IO ConnectionSource

Setup the transport (i.e. SSL) for the given URL. In the case of a HTTP scheme, this just wraps the socket in a Connection.

requestSource

Arguments

:: Connection

the connection to use

-> Request

a request to serialise

-> Maybe Source

a possible payload (for POSTs etc)

-> IO (Maybe (Reply, Maybe Source)) 

A lower level HTTP client, but it allows you to perform POSTs etc