gemcap-0.1.0.1: a simple Gemini capsule (server)
Copyright(C) Jonathan Lamothe
LicenseAGPL-3.0-or-later
Maintainerjonathan@jlamothe.net
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Gemini.Capsule.Internal

Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Important Note

This is an internal module. It is not intended to be accessed by outside packages, and should be considered subject to change at any time.

Synopsis

Documentation

runConnection :: Connection a -> GemHandler -> Maybe Certificate -> IO () Source #

process a request and return a response over a Connection

readURL Source #

Arguments

:: Connection a

the connection

-> IO (Maybe GemURL) 

Reads a GemURL from a Connection

strFromConn Source #

Arguments

:: Int

The maximum number of bytes to read

-> Connection a

The connection to read from

-> IO (Maybe String) 

Reads up to a maxumum number of bytes from a Connection, UTF-8 decodes it, and returns the resulting string (if possible) without the trailing CR/LF

readMax Source #

Arguments

:: Int

the maximum number of bytes

-> Connection a

the Connection to read from

-> IO (Maybe ByteString) 

Reads from a connection up to a maximum number of bytes or a newline character is encountered, returning Nothing if the limit is exceeded

stripCRLF :: String -> Maybe String Source #

Strips the CR/LF characters from the end of a string, retuning Nothing if they are not present