http-types-0.12.3: Generic HTTP types for Haskell (for both client and server code).
Safe Haskell Safe-Inferred
Language Haskell98

Network.HTTP.Types.Header

Synopsis

Types

type RequestHeaders = [ Header ] Source #

Request Headers

type ResponseHeaders = [ Header ] Source #

Response Headers

Common headers

Byte ranges

data ByteRange Source #

RFC 2616 Byte range (individual).

Negative indices are not allowed!

Instances

Instances details
Eq ByteRange Source #
Instance details

Defined in Network.HTTP.Types.Header

Data ByteRange Source #
Instance details

Defined in Network.HTTP.Types.Header

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> ByteRange -> c ByteRange Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ByteRange Source #

toConstr :: ByteRange -> Constr Source #

dataTypeOf :: ByteRange -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ByteRange ) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ByteRange ) Source #

gmapT :: ( forall b. Data b => b -> b) -> ByteRange -> ByteRange Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> ByteRange -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> ByteRange -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> ByteRange -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> ByteRange -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> ByteRange -> m ByteRange Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> ByteRange -> m ByteRange Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> ByteRange -> m ByteRange Source #

Ord ByteRange Source #
Instance details

Defined in Network.HTTP.Types.Header

Show ByteRange Source #
Instance details

Defined in Network.HTTP.Types.Header

type ByteRanges = [ ByteRange ] Source #

RFC 2616 Byte ranges (set).

parseByteRanges :: ByteString -> Maybe ByteRanges Source #

Parse the value of a Range header into a ByteRanges .

>>> parseByteRanges "error"
Nothing
>>> parseByteRanges "bytes=0-499"
Just [ByteRangeFromTo 0 499]
>>> parseByteRanges "bytes=500-999"
Just [ByteRangeFromTo 500 999]
>>> parseByteRanges "bytes=-500"
Just [ByteRangeSuffix 500]
>>> parseByteRanges "bytes=9500-"
Just [ByteRangeFrom 9500]
>>> parseByteRanges "bytes=0-0,-1"
Just [ByteRangeFromTo 0 0,ByteRangeSuffix 1]
>>> parseByteRanges "bytes=500-600,601-999"
Just [ByteRangeFromTo 500 600,ByteRangeFromTo 601 999]
>>> parseByteRanges "bytes=500-700,601-999"
Just [ByteRangeFromTo 500 700,ByteRangeFromTo 601 999]