Spaceboy.Header (Spaceboy v0.1.1) View Source

Struct representing Gemini header response.

You should not create headers directly - all supported headers has functions with correct codes.

Link to this section Summary

Utils

Correctly format the response header

Link to this section Types

Specs

t() :: %Spaceboy.Header{code: pos_integer(), meta: String.t() | pos_integer()}

Link to this section Input

Specs

input(prompt :: String.t()) :: t()

Specs

sensitive_input(prompt :: String.t()) :: t()

Link to this section Success

Link to this function

success(mime \\ "text/gemini; charset=utf-8")

View Source

Specs

success(mime :: String.t()) :: t()

Link to this section Redirect

Link to this function

permanent_redirect(dest)

View Source

Specs

permanent_redirect(dest :: String.t()) :: t()

Specs

redirect(dest :: String.t()) :: t()
Link to this function

temporary_redirect(dest)

View Source

Specs

temporary_redirect(dest :: String.t()) :: t()

Link to this section Temporary Failure

Specs

cgi_error(reason :: String.t()) :: t()

Specs

proxy_error(reason :: String.t()) :: t()
Link to this function

server_unavailable(reason)

View Source

Specs

server_unavailable(reason :: String.t()) :: t()
Link to this function

slow_down(wait_time \\ 60)

View Source

Specs

slow_down(wait_time :: pos_integer()) :: t()
Link to this function

temporary_failure(reason)

View Source

Specs

temporary_failure(reason :: String.t()) :: t()

Link to this section Permanent Failure

Specs

bad_request(desc :: String.t()) :: t()

Specs

gone(desc :: String.t()) :: t()

Specs

not_found(desc :: String.t()) :: t()

Specs

permanent_failure(desc :: String.t()) :: t()
Link to this function

proxy_request_refused(desc)

View Source

Specs

proxy_request_refused(desc :: String.t()) :: t()

Link to this section Client Certificate Required

Link to this function

certificate_not_authorised(prompt)

View Source

Specs

certificate_not_authorised(prompt :: String.t()) :: t()
Link to this function

certificate_not_valid(prompt)

View Source

Specs

certificate_not_valid(prompt :: String.t()) :: t()
Link to this function

client_certificate_required(prompt)

View Source

Specs

client_certificate_required(prompt :: String.t()) :: t()

Link to this section Utils

Specs

format(header :: t()) :: String.t()

Correctly format the response header

Examples

iex> "Test input" |> Spaceboy.Header.input() |> Spaceboy.Header.format()
"10 Test input\r\n"

iex> Spaceboy.Header.success() |> Spaceboy.Header.format()
"20 text/gemini; charset=utf-8\r\n"