HTTP-4000.3.7: A library for client-side HTTP

Copyright | See LICENSE file
License | BSD
Maintainer | Ganesh Sittampalam <ganesh@earth.li>
Stability | experimental
Portability | non-portable (not tested)
Safe Haskell | None
Language | Haskell98

Network.HTTP.HandleStream

Description

A `HandleStream`-based version of Network.HTTP interface.

For more detailed information about what the individual exports do, please consult the documentation for Network.HTTP. Notice however that the functions here do not perform any kind of normalization prior to transmission (or receipt); you are responsible for doing any such yourself, or, if you prefer, just switch to using Network.HTTP function instead.

Synopsis

- simpleHTTP :: HStream ty => Request ty -> IO (Result (Response ty))
- simpleHTTP_ :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty))
- sendHTTP :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty))
- sendHTTP_notify :: HStream ty => HandleStream ty -> Request ty -> IO () -> IO (Result (Response ty))
- receiveHTTP :: HStream bufTy => HandleStream bufTy -> IO (Result (Request bufTy))
- respondHTTP :: HStream ty => HandleStream ty -> Response ty -> IO ()
- simpleHTTP_debug :: HStream ty => FilePath -> Request ty -> IO (Result (Response ty))

# Documentation

simpleHTTP :: HStream ty => Request ty -> IO (Result (Response ty)) #

`simpleHTTP` transmits a resource across a non-persistent connection.

simpleHTTP_ :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty)) #

Like `simpleHTTP`, but acting on an already opened stream.

sendHTTP :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty)) #

`sendHTTP hStream httpRequest` transmits `httpRequest` over `hStream`, but does not alter the status of the connection, nor request it to be closed upon receiving the response.

sendHTTP_notify :: HStream ty => HandleStream ty -> Request ty -> IO () -> IO (Result (Response ty)) #

`sendHTTP_notify hStream httpRequest action` behaves like `sendHTTP`, but lets you supply an IO `action` to execute once the request has been successfully transmitted over the connection. Useful when you want to set up tracing of request transmission and its performance.

receiveHTTP :: HStream bufTy => HandleStream bufTy -> IO (Result (Request bufTy)) #

`receiveHTTP hStream` reads a `Request` from the `HandleStream` `hStream`

respondHTTP :: HStream ty => HandleStream ty -> Response ty -> IO () #

`respondHTTP hStream httpResponse` transmits an HTTP `Response` over the `HandleStream` `hStream`. It could be used to implement simple web server interactions, performing the dual role to `sendHTTP`.

simpleHTTP_debug :: HStream ty => FilePath -> Request ty -> IO (Result (Response ty)) #

`simpleHTTP_debug debugFile req` behaves like `simpleHTTP`, but logs the HTTP operation via the debug file `debugFile`.