Flamenco.Writer.write
— Methodwrite(status_code::Int16, headers::Dict{String, String}; body::String="") :: String
Return HTTP response string
- Status line
- Headers
- Empty line
- Body (optional)
Flamenco.close_server
— Methodclose_server()
Stop Flamenco server
Flamenco.start_server
— Functionstart_server(
f::Function,
host::Union{Sockets.IPAddr, String}=Sockets.localhost,
port::Int64=8000
) :: Server.Request
Start Flamenco server on specified host/port f
is function that parsed request
is forwarded to
Flamenco.write_response
— Methodwrite_response(status_code::Int16, headers::Dict{String, String}; body::String) :: String
Return HTTP response String
Flamenco.Server.Utils.has_header
— Methodhas_header(headers::Dict{String, String}, key::String, value::String) :: Bool
Check whether corresponding (key, value) pair exists in Header
Flamenco.Server.Writer.write
— Methodwrite(status_code::Int16, headers::Dict{String, String}; body::String="") :: String
Return HTTP response string
- Status line
- Headers
- Empty line
- Body (optional)
Flamenco.Server.ParserHttp1_1.InternalError
— TypeInternalError()
Internal error
Flamenco.Server.ParserHttp1_1.TimeoutError
— TypeTimeoutError()
Parsing timeout error
Flamenco.Server.ParserHttp1_1._check_next_char_as_expected
— Method_check_next_char_as_expected(stream::BufferedStreams.BufferedInputStream, ch::Int64) :: Bool
Check if next char in stream matches expectation
Flamenco.Server.ParserHttp1_1._found_crlf
— Method_found_crlf(stream::BufferedStreams.BufferedInputStream) :: Bool
Find CRLF (line termination)
Flamenco.Server.ParserHttp1_1._is_eof
— Method_is_eof(stream::BufferedStreams.BufferedInputStream) :: Bool
Check if parsing reached end of stream
Flamenco.Server.ParserHttp1_1._is_http_1_1
— Method_is_http_1_1(stream::BufferedStreams.BufferedInputStream) :: Bool
Ensure is HTTP 1.1
Flamenco.Server.ParserHttp1_1._is_printable_ascii
— Method_is_printable_ascii(ch::UInt8) :: Bool
Check if char is printable ASCII value
Flamenco.Server.ParserHttp1_1._parse_body
— Method_parse_body(stream::BufferedStreams.BufferedInputStream, method::String) :: String
Return Body as String, for PUT & POST requests
Flamenco.Server.ParserHttp1_1._parse_headers
— Method_parse_headers(stream::BufferedStreams.BufferedInputStream) :: Dict{String, String}
Return Header as Dict As counter-measure againt Slowloris attack, if parsing takes longer than 4 seconds => return 408 status
Flamenco.Server.ParserHttp1_1._parse_method
— Method_parse_method(stream::BufferedStreams.BufferedInputStream) :: String
Return HTTP method as String, among [DELETE, GET, OPTIONS, POST, PUT]
Flamenco.Server.ParserHttp1_1._parse_request_line
— Method_parse_request_line(stream::BufferedStreams.BufferedInputStream) :: Tuple{String, String}
Return Method & Target from Request line
Flamenco.Server.ParserHttp1_1._parse_target
— Method_parse_target(stream::BufferedStreams.BufferedInputStream) :: String
Return Target as String
Flamenco.Server.ParserHttp1_1.parse_request
— Methodparse_request(stream::BufferedStreams.BufferedInputStream) :: Tuple {String, String, Dict{String, String}, String}
Parse HTTP request (Target, Method, Headers, Body) Only parse Header once, as counter-measure againt Slowloris attack
Flamenco.Server._handle_connection
— Method_handle_connection(buffered_stream::BufferedStreams.BufferedInputStream) :: Tuple{Error, Request}
Forward BufferedInputStream to Http1.1 parser If error occurs, return Error struct and empty Request struct
Flamenco.Server.close
— Methodclose()
Stop listening on Socket
Flamenco.Server.start
— Methodstart(f::Function, host::Union{Sockets.IPAddr, String}, port::Integer) :: Request
Listen to incoming requests on separate threads Write response (execute corresponding Julia function) to Socket, before closing it